/* Portal de chamados — cliente e administrador */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 450;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 var(--space-3); letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--space-3); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------- botões e formulários ---------------- */
.btn {
  --b: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 42px; padding: .55em 1.1em;
  font: 600 var(--fs-sm)/1.2 var(--font-body);
  color: var(--text); background: var(--b);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--gradient); color: var(--brand-ink); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: rgba(239,68,68,.5); color: #fca5a5; }
.btn-danger:hover { border-color: var(--danger); background: rgba(239,68,68,.1); }
.btn-sm { min-height: 34px; padding: .35em .8em; font-size: var(--fs-xs); }
.btn-block { width: 100%; }

.field { display: grid; gap: 6px; margin-bottom: var(--space-4); }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: .65em .85em;
  font: inherit; font-size: var(--fs-sm); color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 140px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(207,161,80,.18); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2em; }
.form-grid { display: grid; gap: 0 var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.check { display: flex; align-items: center; gap: .6em; font-size: var(--fs-sm); cursor: pointer; margin-bottom: var(--space-3); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.alert { padding: .8em 1em; border-radius: var(--radius-sm); font-size: var(--fs-sm); margin-bottom: var(--space-4); border: 1px solid; }
.alert-error { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.35); color: #fecaca; }
.alert-ok { background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.35); color: #bbf7d0; }
.alert-warn { background: rgba(250,178,25,.08); border-color: rgba(250,178,25,.35); color: #fde68a; }

/* ---------------- login ---------------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: var(--space-5) 16px;
  background:
    radial-gradient(60vmax 60vmax at 85% -10%, rgba(122,52,214,.18), transparent 60%),
    radial-gradient(50vmax 50vmax at -10% 110%, rgba(207,161,80,.14), transparent 60%),
    var(--bg);
}
.auth-card {
  width: min(100%, 420px); padding: clamp(1.5rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.auth-card .logo { display: block; height: 84px; width: auto; margin: 0 auto var(--space-6); }
.auth-card h1 { font-size: var(--fs-xl); }
.auth-foot { margin-top: var(--space-5); font-size: var(--fs-xs); color: var(--muted); text-align: center; }

/* ---------------- layout do app ---------------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--bg-2) 260px, var(--bg) 260px); }
@media (max-width: 1440px) { .app { grid-template-columns: 236px 1fr; background: linear-gradient(to right, var(--bg-2) 236px, var(--bg) 236px); } }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  background: var(--bg-2); border-right: 1px solid var(--border);
}
.sidebar .logo { height: 20px; width: auto; margin: 6px var(--space-3) var(--space-6); }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: .75em; padding: .7em .85em;
  color: var(--text-2); border-radius: var(--radius-sm); font-weight: 500; font-size: var(--fs-sm);
  text-decoration: none;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--brand); }
.nav .count { margin-left: auto; min-width: 22px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 700; text-align: center; line-height: 20px; }
.sidebar-foot { margin-top: auto; padding: var(--space-4) var(--space-2) 0; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.sidebar-foot .who { font-weight: 600; }
.sidebar-foot .who small { display: block; color: var(--muted); font-weight: 400; }
.sidebar-foot .btn { margin-top: var(--space-3); }

.app > div { min-width: 0; }
.topbar { display: none; }
.main { min-width: 0; padding: clamp(1rem, 2.5vw, 2.5rem) clamp(1rem, 3vw, 3rem) var(--space-7); }
.main-inner { max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(290px, 85vw); z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    position: sticky; top: 0; z-index: 20; padding: 10px 16px;
    background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .logo { height: 16px; width: auto; }
  .menu-btn { width: 42px; height: 42px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); cursor: pointer; }
}

/* ---------------- cartões e métricas ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1rem, 2vw, 1.5rem); }
.card + .card { margin-top: var(--space-4); }
.grid > .card, .wa-grid > .card, .ticket-layout > .card { margin-top: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-head h2, .card-head h3 { margin: 0; font-size: var(--fs-lg); }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1200px) { .grid-3-1 { grid-template-columns: 1fr; } }

.stats { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); margin-bottom: var(--space-4); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4) var(--space-5); }
.stat .label { font-size: var(--fs-xs); color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .value { font-family: var(--font-display); font-size: clamp(1.45rem, 0.9rem + 1.3vw, 2.4rem); white-space: nowrap; font-weight: 700; line-height: 1.15; margin-top: 6px; }
.stat .sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.stat.accent { background: linear-gradient(160deg, rgba(207,161,80,.12), rgba(122,52,214,.06)), var(--surface); border-color: rgba(207,161,80,.25); }

/* ---------------- etiquetas ---------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-aberto { color: #e6c27c; background: rgba(207,161,80,.1); border-color: rgba(207,161,80,.25); }
.st-em_andamento { color: #c4b5fd; background: rgba(122,52,214,.12); border-color: rgba(122,52,214,.3); }
.st-aguardando_cliente { color: #fde68a; background: rgba(250,178,25,.1); border-color: rgba(250,178,25,.3); }
.st-fechado { color: #a7b3c7; background: rgba(148,163,184,.1); border-color: rgba(148,163,184,.25); }
.pr-baixa { color: #86efac; background: rgba(34,197,94,.08); }
.pr-media { color: #fde68a; background: rgba(250,178,25,.08); }
.pr-alta { color: #fdba74; background: rgba(236,131,90,.1); }
.pr-critica { color: #fca5a5; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35); }

/* ---------------- tabela que vira cartões no celular ---------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.toolbar .input { width: auto; flex: 1 1 180px; min-height: 40px; }
.toolbar select.input { flex: 0 1 190px; }
@media (max-width: 600px) { .toolbar .input, .toolbar select.input { flex: 1 1 100%; } }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .subject { font-weight: 600; color: var(--text); }
.table .sub { font-size: var(--fs-xs); color: var(--muted); }
.perm-badges { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.table td.cell-perms { max-width: 320px; }
.empty { padding: var(--space-7) var(--space-4); text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  .table-wrap { border: 0; background: none; overflow: visible; }
  table.table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
  .table td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
  .table td[data-label]::before { content: attr(data-label); font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .table td.cell-main { display: block; padding-bottom: 8px; }
  .table td > * { min-width: 0; }
  .table td[data-label]::before { flex: none; }
  .table td.cell-perms { max-width: none; align-items: flex-start; }
  .table td.cell-perms::before { padding-top: 4px; }
  .perm-badges { justify-content: flex-end; flex: 1; }
}

/* ---------------- detalhe do chamado ---------------- */
.ticket-layout { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 1100px) { .ticket-layout { grid-template-columns: 1fr; } }
.meta-list { display: grid; gap: 12px; margin: 0; }
.meta-list div { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; text-align: right; font-weight: 500; }
.thread { display: grid; gap: var(--space-3); margin: var(--space-4) 0; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.msg .who { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 4px; }
.msg .who strong { color: var(--text-2); }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg.mine { justify-self: end; background: rgba(207,161,80,.08); border-color: rgba(207,161,80,.22); }
.msg.first { max-width: 100%; background: var(--bg-2); }
@media (max-width: 600px) { .msg { max-width: 100%; } }

/* ---------------- gráfico ---------------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #33155a; stroke-width: 1; }
.chart .axis-line { stroke: #4a2a72; stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: rgba(196,170,255,.06); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: var(--fs-xs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  padding: 10px 12px; font-size: var(--fs-xs); line-height: 1.5;
  background: #160230; border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
}
.tooltip .t { color: var(--text-2); margin-bottom: 4px; font-weight: 600; }
.tooltip .r { display: flex; align-items: center; gap: 8px; color: var(--text); }
.tooltip .r i { width: 10px; height: 10px; border-radius: 2px; }
.tooltip .r b { margin-left: auto; font-variant-numeric: tabular-nums; }

.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 40px; gap: 12px; align-items: center; font-size: var(--fs-sm); }
.hbar .track { height: 10px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; min-width: 2px; }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------------- modal e aviso ---------------- */
dialog.modal { width: min(560px, calc(100% - 32px)); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(10,0,24,.7); backdrop-filter: blur(3px); }
.modal-body { padding: clamp(1.25rem, 3vw, 2rem); }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.secret { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--bg-2); border: 1px dashed var(--brand); border-radius: var(--radius-sm); font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-lg); word-break: break-all; }
.secret code { flex: 1; }

.toast-zone { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 8px; max-width: calc(100% - 32px); }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: var(--fs-sm); animation: toast-in .2s ease; }
.toast.error { border-color: rgba(239,68,68,.6); }
.toast.ok { border-color: rgba(34,197,94,.6); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- WhatsApp ---------------- */
.wa-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .wa-grid { grid-template-columns: 1fr; } }
.qr-box { display: grid; place-items: center; width: min(100%, 300px); aspect-ratio: 1; margin: var(--space-4) auto; padding: 14px; background: #fff; border-radius: var(--radius); }
.qr-box svg { width: 100%; height: 100%; }
.wa-status { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.wa-status .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(125,138,163,.15); }
.wa-status.connected .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(34,197,94,.2); }
.wa-status.qr .dot, .wa-status.connecting .dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(250,178,25,.2); animation: pulse 1.4s infinite; }
.wa-status.unavailable .dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: .4; } }
.steps { margin: 0; padding-left: 1.2em; color: var(--text-2); font-size: var(--fs-sm); }
.steps li { margin-bottom: 6px; }
.numbers { display: grid; gap: 8px; margin-bottom: var(--space-3); }
.numbers .row { display: flex; gap: 8px; }

.loading { padding: var(--space-7); text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; margin: 0 auto 12px; border: 3px solid var(--surface-3); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------------- app instalado (tela cheia no celular) ---------------- */
@supports (padding: env(safe-area-inset-top)) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); padding-left: calc(16px + env(safe-area-inset-left)); padding-right: calc(16px + env(safe-area-inset-right)); }
  .auth-page { padding-top: calc(var(--space-5) + env(safe-area-inset-top)); padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom)); }
  .main { padding-bottom: calc(var(--space-7) + env(safe-area-inset-bottom)); }
  @media (max-width: 960px) {
    .sidebar { padding-top: calc(var(--space-5) + env(safe-area-inset-top)); padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom)); }
  }
  .toast-zone { bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
}

/* ---------------- aviso para ativar notificações ---------------- */
.push-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: var(--space-5); padding: 14px 18px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(207,161,80,.16), transparent 60%), var(--surface);
  border: 1px solid rgba(207,161,80,.4); border-radius: var(--radius); }
.push-banner .ico { font-size: 22px; }
.push-banner p { flex: 1 1 260px; margin: 0; font-size: var(--fs-sm); color: var(--text); }
.push-banner .pb-actions { display: flex; gap: 8px; }

/* ---------------- abas segmentadas ---------------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin-bottom: var(--space-4); background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; }
.seg button { font: 600 var(--fs-sm) var(--font-body); color: var(--text-2); background: transparent; border: 0; padding: 9px 14px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.seg button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand); }
.seg-on { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 99px; background: rgba(34,197,94,.15); color: #86efac; }

/* ================= CRM: chat, conversas, funil, lead ================= */
.pane {
  display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  height: calc(100vh - 210px); min-height: 460px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.pane-list { overflow-y: auto; border-right: 1px solid var(--border); background: var(--bg-2); }
.pane-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  color: var(--text); text-align: left; text-decoration: none !important;
  background: transparent; border: 0; border-bottom: 1px solid var(--border); font: inherit; cursor: pointer;
}
.pane-item:hover { background: var(--surface); }
.pane-item.active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--brand); }
.pi-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pi-main strong { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-main small { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-side { display: grid; justify-items: end; gap: 4px; flex: none; }
.pi-side small { font-size: 11px; color: var(--muted); }
.pane-item .count, .pi-side .count { min-width: 22px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 700; text-align: center; line-height: 20px; flex: none; }
.avatar {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%;
  font-weight: 700; font-size: var(--fs-sm); color: var(--text);
  background: var(--surface-3); border: 1px solid var(--border-strong);
}
.avatar.general { background: var(--gradient); color: var(--brand-ink); border-color: transparent; font-size: 1.1rem; }
.avatar.group { background: var(--surface-2); }
.avatar.wa { background: rgba(37,211,102,.14); border-color: rgba(37,211,102,.35); color: #86efac; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tags em, .kmeta em { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .03em; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.tags .t-client { background: rgba(207,161,80,.16); color: #f2d39a; }
.tags .t-lead { background: rgba(96,165,250,.15); color: #bfdbfe; }
.tags .t-ticket { background: rgba(250,178,25,.14); color: #fde68a; }
.kmeta .t-wa { background: rgba(37,211,102,.15); color: #86efac; }

.pane-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.pane-thread > .empty { margin: auto; }
.pt-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pt-head > div { flex: 1; min-width: 0; display: grid; }
.pt-head small { font-size: var(--fs-xs); color: var(--muted); }
.pt-back { display: none; }
.pt-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 18px 16px; }
.bubble {
  align-self: flex-start; max-width: min(75%, 620px); padding: 8px 12px 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px;
  font-size: var(--fs-sm); word-break: break-word;
}
.bubble > div { white-space: pre-wrap; }
.bubble b { display: block; font-size: var(--fs-xs); color: var(--brand); margin-bottom: 2px; }
.bubble time { display: block; text-align: right; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.bubble.mine { align-self: flex-end; background: rgba(207,161,80,.12); border-color: rgba(207,161,80,.28); border-radius: 14px 14px 4px 14px; }
.day-sep { display: flex; justify-content: center; margin: 10px 0 6px; pointer-events: none; }
.day-sep span { font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2, var(--surface)); border: 1px solid var(--border); padding: 4px 12px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); }
.composer textarea.input { min-height: 44px; max-height: 160px; resize: none; }
.composer .btn { width: 46px; min-height: 44px; padding: 0; flex: none; }
.risk-note { font-size: var(--fs-xs); margin-bottom: var(--space-3); }
.pick { display: grid; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pick .pane-item:last-child { border-bottom: 0; }

@media (max-width: 960px) {
  .pane { grid-template-columns: 1fr; height: calc(100dvh - 200px); min-height: 380px; }
  .pane.has-open .pane-list { display: none; }
  .pane:not(.has-open) .pane-thread { display: none; }
  .pane-list { border-right: 0; }
  .pt-back { display: inline-flex; }
  .bubble { max-width: 88%; }
  .pane:not(.has-open) { height: auto; min-height: 0; }
  .main-inner:has(.pane.has-open) .page-head { display: none; }
  .pane.has-open { height: calc(100dvh - 64px - 2rem - env(safe-area-inset-bottom)); min-height: 320px; margin: -4px -4px 0; }
  .pt-head { padding: 10px 12px; }
  .pt-msgs { padding: 14px 10px; }
  .kanban { grid-auto-columns: 84%; scroll-snap-type: x mandatory; }
}

/* funil (kanban) */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: var(--space-3); overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.kcol { display: flex; flex-direction: column; min-height: 320px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); scroll-snap-align: start; transition: border-color .15s, background .15s; }
.kcol.over { border-color: var(--brand); background: rgba(207,161,80,.05); }
.kcol header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.kcol header span { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.kcol[data-stage="ganho"] header { box-shadow: inset 0 3px 0 var(--ok); }
.kcol[data-stage="perdido"] header { box-shadow: inset 0 3px 0 var(--danger); }
.kcol[data-stage="novo"] header { box-shadow: inset 0 3px 0 #60a5fa; }
.kcol[data-stage="contato"] header { box-shadow: inset 0 3px 0 var(--warn); }
.kcol[data-stage="proposta"] header { box-shadow: inset 0 3px 0 var(--brand); }
.kcards { display: grid; align-content: start; gap: 8px; padding: 10px; flex: 1; }
.kcard {
  position: relative; display: grid; gap: 4px; padding: 12px 14px; color: var(--text); text-decoration: none !important;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: grab;
  transition: border-color .15s, transform .1s;
}
.kcard:hover { border-color: var(--border-strong); }
.kcard.dragging { opacity: .5; transform: rotate(1deg); }
.kcard strong { font-size: var(--fs-sm); padding-right: 30px; }
.kcard small { font-size: var(--fs-xs); color: var(--muted); }
.kmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: var(--fs-xs); }
.kmeta b { color: var(--brand); font-variant-numeric: tabular-nums; }
.ktask { font-size: 11.5px; color: var(--text-2); }
.ktask.late { color: #fca5a5; }
.kowner { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.kempty { text-align: center; color: var(--muted); padding: 18px 0; font-size: var(--fs-sm); }
.tasks-card { margin-bottom: var(--space-4); }
.tasks-card ul { margin: 8px 0 0; padding-left: 1.1em; display: grid; gap: 4px; font-size: var(--fs-sm); }
.tasks-card li.late a { color: #fca5a5; }

/* página do lead */
.stages { display: flex; gap: 4px; margin-bottom: var(--space-4); overflow-x: auto; }
.stages .stage {
  flex: 1 0 auto; min-height: 40px; padding: 8px 16px; font: 600 var(--fs-sm) var(--font-body); color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
}
.stages .stage:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.stages .stage:hover { color: var(--text); background: var(--surface-2); }
.stages .stage.past { background: rgba(207,161,80,.12); color: #f2d39a; }
.stages .stage.on { background: var(--gradient); color: var(--brand-ink); }
.stages .stage.on.st-ganho { background: var(--ok); color: #052e14; }
.stages .stage.on.st-perdido { background: var(--danger); color: #fff; }
.timeline-crm { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline-crm li { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding-bottom: 16px; }
.timeline-crm li::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 2px; background: var(--border); }
.timeline-crm li:last-child::before { display: none; }
.timeline-crm .ti { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); font-size: 15px; }
.timeline-crm small { display: block; font-size: var(--fs-xs); color: var(--muted); padding-top: 7px; }
.timeline-crm p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; font-size: var(--fs-sm); }
.timeline-crm li.wa .ti { background: rgba(37,211,102,.12); border-color: rgba(37,211,102,.3); }
.timeline-crm li.task .ti, .timeline-crm li.meeting .ti { background: rgba(250,178,25,.12); border-color: rgba(250,178,25,.3); }
.timeline-crm li.done p { text-decoration: line-through; color: var(--muted); }
.timeline-crm li.stage p, .timeline-crm li.system p { color: var(--text-2); }

/* chamado: registros internos e contato */
.msg.k-note, .msg.k-call { justify-self: stretch; max-width: 100%; background: rgba(250,178,25,.06); border: 1px dashed rgba(250,178,25,.4); }
.msg.k-whatsapp, .msg.k-whatsapp_in { border-color: rgba(37,211,102,.35); background: rgba(37,211,102,.06); }
.msg.k-whatsapp_in { justify-self: start; }
.msg.k-email { border-color: rgba(96,165,250,.35); background: rgba(96,165,250,.06); }
.ktag { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 10.5px; font-weight: 600; }
.contact-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.contact-btns .btn { width: 100%; }
.bubble.pending { opacity: .6; }

/* mídias e reações nas conversas do WhatsApp */
.bubble { position: relative; }
.bubble.is-sticker { background: transparent; border-color: transparent; padding: 2px; }
.wa-sticker { display: block; width: 150px; height: 150px; object-fit: contain; }
.wa-img { display: block; max-width: min(320px, 100%); max-height: 360px; border-radius: 10px; margin-bottom: 4px; object-fit: cover; }
.wa-video { display: block; max-width: min(340px, 100%); max-height: 360px; border-radius: 10px; margin-bottom: 4px; background: #000; }
.wa-audio { display: block; width: min(300px, 70vw); height: 40px; margin: 2px 0 4px; }
.wa-doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 4px; border-radius: 10px; background: rgba(0,0,0,.18); color: var(--text); text-decoration: none !important; }
.wa-doc span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.wa-doc small { color: var(--brand); font-weight: 600; }
.wa-media-st { font-size: var(--fs-xs); color: var(--muted); padding: 6px 0; }
.msg-tools { position: absolute; top: 50%; transform: translateY(-50%); right: -74px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.bubble.mine .msg-tools { right: auto; left: -74px; flex-direction: row-reverse; }
.bubble:hover .msg-tools, .msg-tools:focus-within { opacity: 1; }
.react-btn, .reply-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 15px; line-height: 1; cursor: pointer; padding: 0;
}
.react-btn:hover, .reply-btn:hover { color: var(--text); border-color: var(--border-strong); }
@media (hover: none) { .msg-tools { display: none; } .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.reacts { position: absolute; bottom: -12px; right: 8px; display: flex; gap: 2px; padding: 1px 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border-strong); font-size: 13px; line-height: 20px; }
.bubble.mine .reacts { right: auto; left: 8px; }
.reacts .me { filter: drop-shadow(0 0 2px rgba(207,161,80,.7)); }
.bubble:has(.reacts) { margin-bottom: 12px; }
.react-pop {
  position: absolute; z-index: 10; bottom: calc(100% + 6px); left: 0; display: flex; gap: 2px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 99px; box-shadow: var(--shadow);
}
.bubble.mine .react-pop { left: auto; right: 0; }
.react-pop button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 20px; cursor: pointer; color: var(--text-2); }
.react-pop button:hover, .react-pop button.on { background: var(--surface-3); }

/* perfil do WhatsApp */
.prof-grid { display: grid; grid-template-columns: 200px 1fr; gap: var(--space-5); align-items: start; }
.prof-photo { display: grid; gap: 8px; justify-items: center; }
.prof-photo img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-strong); background: var(--bg-2); }
@media (max-width: 700px) { .prof-grid { grid-template-columns: 1fr; } }
.react-pop.below { bottom: auto; top: calc(100% + 6px); }

/* ================= conversa no estilo WhatsApp ================= */
.pt-msgs {
  background-color: var(--bg);
  background-image: radial-gradient(rgba(196,170,255,.06) 1px, transparent 1.2px);
  background-size: 20px 20px;
}
.pt-head { flex-wrap: nowrap; position: relative; min-height: 64px; }
.pt-head > div { flex: 1; min-width: 0; }
.pt-head > div strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-head > div small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-avatar { width: 40px; height: 40px; }
.pt-back { display: none; width: 36px; height: 40px; place-items: center; color: var(--text); margin-left: -6px; text-decoration: none !important; }
.pt-more { display: none; width: 40px; height: 40px; place-items: center; border: 0; background: transparent; color: var(--text-2); border-radius: 50%; cursor: pointer; }
.pt-more:hover { background: var(--surface-2); }

.composer { display: block; padding: 8px 10px; }
.cmp-row, .rec-bar { display: flex; align-items: flex-end; gap: 8px; }
.cmp-row[hidden], .rec-bar[hidden] { display: none; }
.composer textarea.input {
  flex: 1; min-height: 46px; max-height: 140px; resize: none; line-height: 1.4;
  padding: 12px 18px; border-radius: 24px; background: var(--surface-2); border-color: transparent; font-size: 16px;
}
.composer textarea.input:focus { border-color: var(--border-strong); box-shadow: none; }
.cmp-btn {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--gradient); color: var(--brand-ink); transition: transform .1s, filter .15s;
}
.cmp-btn:hover { filter: brightness(1.08); }
.cmp-btn:active { transform: scale(.94); }
.cmp-btn[disabled] { opacity: .6; }
.cmp-icon { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: #fca5a5; cursor: pointer; }
.cmp-icon:hover { background: rgba(239,68,68,.12); }
.rec-bar { align-items: center; min-height: 46px; padding-left: 4px; background: var(--surface-2); border-radius: 24px; }
.rec-bar .cmp-btn { margin-left: auto; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: pulse 1s infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 42px; }
.rec-label { color: var(--muted); font-size: var(--fs-sm); }

@media (max-width: 960px) {
  body.thread-open { overflow: hidden; overscroll-behavior: none; }
  body.thread-open .pane.has-open {
    position: fixed; left: 0; right: 0; top: 0; z-index: 45;
    height: 100dvh; min-height: 0; margin: 0; border: 0; border-radius: 0;
    display: flex; flex-direction: column;
  }
  body.thread-open .pane.has-open .pane-thread { flex: 1; min-height: 0; }
  body.thread-open .push-banner, body.thread-open #push-banner { display: none; }
  .pt-head { padding: calc(8px + env(safe-area-inset-top)) 6px 8px 8px; gap: 8px; min-height: calc(60px + env(safe-area-inset-top)); }
  .pt-back { display: grid; }
  .pt-avatar { width: 38px; height: 38px; font-size: 13px; }
  .pt-more { display: grid; }
  .pt-head .pt-actions {
    display: none; position: absolute; right: 8px; top: calc(100% - 4px); z-index: 5; width: auto; min-width: 200px;
    flex-direction: column; align-items: stretch; gap: 0; padding: 6px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow);
  }
  .pt-head.show-actions .pt-actions { display: flex; }
  .pt-head .pt-actions .btn { justify-content: flex-start; border: 0; background: transparent; min-height: 44px; font-size: var(--fs-sm); }
  .pt-head .pt-actions .btn:hover { background: var(--surface-2); }
  .pt-head > .btn-danger { padding: .35em .6em; }
  .pt-msgs { padding: 12px 10px; }
  .composer { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .bubble { max-width: 85%; }
}

/* player de áudio */
.vplayer { display: flex; align-items: center; gap: 8px; width: min(290px, 70vw); padding: 4px 2px 2px; }
.vplayer audio { display: none; }
.vp-play { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--surface-3); color: var(--text); cursor: pointer; }
.bubble.mine .vp-play { background: rgba(207,161,80,.25); color: #f2d39a; }
.vp-track { flex: 1; height: 22px; border-radius: 99px; background: rgba(255,255,255,.14); cursor: pointer; position: relative; padding: 8px 0; background-clip: content-box; }
.vp-fill { position: absolute; left: 0; top: 8px; height: 6px; width: 0; border-radius: 99px; background: var(--brand); }
.vp-time { flex: none; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 30px; }
.vp-speed { flex: none; border: 0; border-radius: 99px; padding: 3px 8px; font: 700 11px var(--font-body); background: rgba(255,255,255,.1); color: var(--text-2); cursor: pointer; }

/* computador: telas de conversa ocupam exatamente a altura da janela (sem rolar a página) */
@media (min-width: 961px) {
  .main:has(#view > .pane) { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding-bottom: clamp(1rem, 2vw, 1.75rem); }
  .main:has(#view > .pane) .main-inner { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; }
  .main:has(#view > .pane) #view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  #view > .pane { flex: 1; height: auto; min-height: 360px; }
  #view > .page-head:has(+ .pane), #view > .page-head:has(~ .pane) { margin-bottom: var(--space-4); }
}
@media (min-width: 961px) and (max-height: 620px) { .main:has(#view > .pane) { height: auto; } }
.composer textarea.input { overflow-y: hidden; scrollbar-width: thin; scrollbar-color: rgba(196,170,255,.25) transparent; }
.pt-msgs, .pane-list { scrollbar-width: thin; scrollbar-color: rgba(196,170,255,.25) transparent; }
.composer textarea.input::-webkit-scrollbar, .pt-msgs::-webkit-scrollbar, .pane-list::-webkit-scrollbar { width: 6px; }
.composer textarea.input::-webkit-scrollbar-thumb, .pt-msgs::-webkit-scrollbar-thumb, .pane-list::-webkit-scrollbar-thumb { background: rgba(196,170,255,.25); border-radius: 99px; }
.composer textarea.input::-webkit-scrollbar-button, .pt-msgs::-webkit-scrollbar-button, .pane-list::-webkit-scrollbar-button { display: none; height: 0; }

/* respostas (citação) e contatos compartilhados */
.wa-quote {
  display: grid; gap: 1px; margin: 2px 0 6px; padding: 6px 10px; border-radius: 8px; cursor: default;
  background: rgba(0,0,0,.22); border-left: 3px solid #a78bfa; font-size: 12.5px; max-width: 100%;
}
.wa-quote[data-goto] { cursor: pointer; }
.wa-quote b { color: #c4b5fd; font-size: 12px; }
.wa-quote.q-me { border-left-color: var(--brand); }
.wa-quote.q-me b { color: var(--brand); }
.wa-quote span { color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-wrap; word-break: break-word; }
.bubble.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(207,161,80,.55); } 100% { box-shadow: none; } }
.bubble.swipe-ready::before { content: "↩"; position: absolute; left: -34px; top: 50%; transform: translateY(-50%); color: var(--brand); font-size: 18px; }
.cmp-reply { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 4px 4px 4px 6px; background: var(--surface-2); border-radius: 12px; }
.cmp-reply[hidden] { display: none; }
.cmp-reply .wa-quote { flex: 1; margin: 0; min-width: 0; }
.cmp-reply .cmp-icon { width: 36px; height: 36px; color: var(--text-2); }
.wa-card { min-width: min(260px, 66vw); margin: 2px 0 4px; border-radius: 10px; background: rgba(0,0,0,.18); overflow: hidden; }
.wa-card + .wa-card { margin-top: 6px; }
.wa-card-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.wa-card-top > div { display: grid; min-width: 0; }
.wa-card-top strong { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-card-top small { color: var(--text-2); font-size: 12px; }
.wa-card-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid rgba(255,255,255,.08); }
.wa-card-actions button { padding: 10px 6px; border: 0; background: transparent; color: var(--brand); font: 600 13px var(--font-body); cursor: pointer; }
.wa-card-actions button + button { border-left: 1px solid rgba(255,255,255,.08); }
.wa-card-actions button:hover { background: rgba(255,255,255,.05); }
.bubble > .wa-card, .bubble > .wa-quote, .bubble > .vplayer, .cmp-reply .wa-quote { white-space: normal; }

/* imagens e vídeos com largura fixa (sem esticar a bolha) */
.wa-img { width: auto; max-width: min(320px, 68vw); }
.wa-video { max-width: min(340px, 68vw); }
.bubble .wa-img, .bubble .wa-video { height: auto; }

/* anexos */
.cmp-row { position: relative; }
.cmp-attach { color: var(--text-2); }
.cmp-attach:hover { background: var(--surface-3); color: var(--text); }
.attach-menu {
  position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 20; display: grid; gap: 2px; padding: 8px; min-width: 220px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow);
}
.attach-menu[hidden] { display: none; }
.attach-menu button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: 500 var(--fs-sm) var(--font-body); cursor: pointer; text-align: left; }
.attach-menu button:hover { background: var(--surface-2); }
.attach-menu button span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-size: 16px; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 50vh; overflow: auto; }
.att-grid.one { grid-template-columns: 1fr; }
.att-item { position: relative; border-radius: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--border); display: grid; place-items: center; min-height: 110px; }
.att-item img, .att-item video { width: 100%; height: 100%; max-height: 50vh; object-fit: contain; display: block; }
.att-grid:not(.one) .att-item img, .att-grid:not(.one) .att-item video { height: 110px; object-fit: cover; }
.att-item > span { position: absolute; left: 6px; bottom: 6px; font-size: 14px; }
.att-doc { padding: 14px; gap: 4px; text-align: center; font-size: 28px; }
.att-doc small { font-size: 12px; color: var(--text-2); word-break: break-all; }
.pane-thread { position: relative; }
.pane-thread.drop-on::after {
  content: "Solte para enviar"; position: absolute; inset: 10px; z-index: 30; display: grid; place-items: center;
  border: 2px dashed var(--brand); border-radius: 14px; background: rgba(19,0,44,.85); color: var(--brand); font-weight: 700; font-size: var(--fs-lg);
}
.wa-loc { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; min-width: min(260px, 66vw); margin: 2px 0 4px; padding: 12px; border-radius: 10px; background: rgba(0,0,0,.2); color: var(--text); text-decoration: none !important; }
.wa-loc-pin { grid-row: span 2; font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: rgba(5,150,105,.2); }
.wa-loc-txt { display: grid; min-width: 0; }
.wa-loc-txt strong { font-size: var(--fs-sm); }
.wa-loc-txt small { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-loc-go { grid-column: 2; color: var(--brand); font-weight: 600; font-size: 12.5px; }
.bubble > .wa-loc { white-space: normal; }
.attach-menu .ai { color: #fff; }
.attach-menu .ai-media { background: linear-gradient(135deg, #a855f7, #6d28d9); }
.attach-menu .ai-doc { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.attach-menu .ai-loc { background: linear-gradient(135deg, #34d399, #059669); }
.attach-menu .ai-ct { background: linear-gradient(135deg, #f2d39a, #cfa150); color: var(--brand-ink); }

/* ===================================================================== TEMA CLARO */
.theme-btn { gap: 8px; }
.theme-btn span { pointer-events: none; }
.theme-mini span { display: none; }
.theme-float {
  position: fixed; top: 16px; right: 16px; z-index: 10; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font: 600 var(--fs-xs) var(--font-body); cursor: pointer;
}
.theme-float:hover { color: var(--text); }
.theme-anim, .theme-anim * { transition: background-color .3s ease, color .3s ease, border-color .3s ease !important; }

:root[data-theme="light"] {
  color-scheme: light;
  --brand:        #A87A2C;   /* dourado mais escuro: legível sobre fundo claro */
  --brand-strong: #8F6620;
  --bg:        #F6F3FA;
  --bg-2:      #EFEAF6;
  --surface:   #FFFFFF;
  --surface-2: #F3EEF9;
  --surface-3: #E6DCF3;
  --border:        rgba(62, 10, 108, 0.10);
  --border-strong: rgba(62, 10, 108, 0.20);
  --text:   #1E063A;
  --text-2: #4B3B66;
  --muted:  #74698A;
  --shadow: 0 10px 34px -14px rgba(30, 6, 58, 0.28);
}
:root[data-theme="light"] .app { background: linear-gradient(to right, var(--bg-2) 260px, var(--bg) 260px); }
@media (max-width: 1440px) { :root[data-theme="light"] .app { background: linear-gradient(to right, var(--bg-2) 236px, var(--bg) 236px); } }
@media (max-width: 960px) { :root[data-theme="light"] .app { background: var(--bg); } }
:root[data-theme="light"] .btn-primary,
:root[data-theme="light"] .cmp-btn { color: #1E063A; }
:root[data-theme="light"] .btn-danger { color: #b91c1c; }
:root[data-theme="light"] .alert-error { color: #991b1b; }
:root[data-theme="light"] .alert-ok { color: #166534; }
:root[data-theme="light"] .alert-warn { color: #92400e; }
:root[data-theme="light"] .st-aberto { color: #8a5f12; }
:root[data-theme="light"] .st-em_andamento { color: #5b21b6; }
:root[data-theme="light"] .st-aguardando_cliente { color: #92400e; }
:root[data-theme="light"] .st-fechado { color: #475569; }
:root[data-theme="light"] .pr-baixa { color: #15803d; }
:root[data-theme="light"] .pr-media { color: #a16207; }
:root[data-theme="light"] .pr-alta { color: #c2410c; }
:root[data-theme="light"] .pr-critica { color: #b91c1c; }
:root[data-theme="light"] .chart .grid-line { stroke: #ebe4f3; }
:root[data-theme="light"] .chart .axis-line { stroke: #d4c8e4; }
:root[data-theme="light"] .tooltip { background: #fff; }
:root[data-theme="light"] .seg-on, :root[data-theme="light"] .avatar.wa, :root[data-theme="light"] .kmeta .t-wa { color: #15803d; }
:root[data-theme="light"] .tags .t-client { color: #8a5f12; }
:root[data-theme="light"] .tags .t-lead { color: #1d4ed8; }
:root[data-theme="light"] .tags .t-ticket { color: #92400e; }
:root[data-theme="light"] .ktask.late, :root[data-theme="light"] .tasks-card li.late a, :root[data-theme="light"] .cmp-icon { color: #dc2626; }
:root[data-theme="light"] .cmp-attach { color: var(--text-2); }
:root[data-theme="light"] .stages .stage.past { color: #8a5f12; }
:root[data-theme="light"] .avatar.general { color: #1E063A; }
:root[data-theme="light"] .nav .count, :root[data-theme="light"] .pane-item .count, :root[data-theme="light"] .pi-side .count { color: #fff; }
:root[data-theme="light"] .app.nav-open::after { background: rgba(30,6,58,.35); }
:root[data-theme="light"] .topbar { background: color-mix(in srgb, var(--surface) 92%, transparent); }

/* conversas no claro: fundo com pontinhos suaves e bolhas como no WhatsApp */
:root[data-theme="light"] .pt-msgs { background-color: #F1ECF7; background-image: radial-gradient(rgba(62,10,108,.07) 1px, transparent 1.2px); }
:root[data-theme="light"] .bubble { background: #fff; border-color: rgba(62,10,108,.08); box-shadow: 0 1px 1px rgba(30,6,58,.06); }
:root[data-theme="light"] .bubble.mine { background: #F7EBD3; border-color: rgba(168,122,44,.25); }
:root[data-theme="light"] .bubble.is-sticker { background: transparent; border-color: transparent; box-shadow: none; }
:root[data-theme="light"] .day-sep span { background: #fff; }
:root[data-theme="light"] .wa-quote { background: rgba(62,10,108,.06); border-left-color: #7c3aed; }
:root[data-theme="light"] .wa-quote b { color: #6d28d9; }
:root[data-theme="light"] .wa-quote.q-me b { color: var(--brand); }
:root[data-theme="light"] .wa-card, :root[data-theme="light"] .wa-loc, :root[data-theme="light"] .wa-doc { background: rgba(62,10,108,.05); }
:root[data-theme="light"] .wa-card-actions { border-top-color: rgba(62,10,108,.1); }
:root[data-theme="light"] .wa-card-actions button + button { border-left-color: rgba(62,10,108,.1); }
:root[data-theme="light"] .vp-track { background: rgba(62,10,108,.15); background-clip: content-box; }
:root[data-theme="light"] .vp-speed { background: rgba(62,10,108,.08); }
:root[data-theme="light"] .vp-play { background: var(--surface-3); }
:root[data-theme="light"] .bubble.mine .vp-play { background: rgba(168,122,44,.2); color: #8a5f12; }
:root[data-theme="light"] .composer textarea.input { background: var(--surface-2); }
:root[data-theme="light"] .rec-bar { background: var(--surface-2); }
:root[data-theme="light"] .msg.mine { background: #F7EBD3; border-color: rgba(168,122,44,.25); }
:root[data-theme="light"] .auth-page {
  background:
    radial-gradient(60vmax 60vmax at 85% -10%, rgba(122,52,214,.12), transparent 60%),
    radial-gradient(50vmax 50vmax at -10% 110%, rgba(207,161,80,.16), transparent 60%),
    var(--bg);
}
:root[data-theme="light"] dialog.modal::backdrop { background: rgba(30,6,58,.35); }
:root[data-theme="light"] .composer textarea.input, :root[data-theme="light"] .pt-msgs, :root[data-theme="light"] .pane-list { scrollbar-color: rgba(62,10,108,.2) transparent; }
:root[data-theme="light"] .pt-msgs::-webkit-scrollbar-thumb, :root[data-theme="light"] .pane-list::-webkit-scrollbar-thumb { background: rgba(62,10,108,.2); }

/* rodapé da barra lateral: conta + menu recolhível */
.sidebar-foot { position: relative; padding: var(--space-3) 0 0; }
.sidebar-foot .btn { margin-top: 0; }
.who-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
  border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; text-align: left; font: inherit;
}
.who-btn:hover, .who-btn.open { background: var(--surface); border-color: var(--border); }
.who-av { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--gradient); color: var(--brand-ink); }
.who-btn.has-warn .who-av::after { content: ""; position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); border: 2px solid var(--bg-2); }
.who-btn .who { flex: 1; min-width: 0; font-weight: 600; font-size: var(--fs-sm); }
.who-btn .who > span, .who-btn .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-btn .who small { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); }
.who-chev { color: var(--muted); display: grid; transition: transform .2s; }
.who-btn.open .who-chev { transform: rotate(180deg); }
.foot-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20; display: grid; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow);
  animation: fm-in .14s ease;
}
.foot-menu[hidden] { display: none; }
@keyframes fm-in { from { opacity: 0; transform: translateY(6px); } }
.fm-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); font: 500 var(--fs-sm) var(--font-body); cursor: pointer; text-align: left;
}
.fm-item[hidden] { display: none; }
.fm-item:hover { background: var(--surface-2); color: var(--text); }
.fm-item svg { flex: none; }
.fm-item span { pointer-events: none; }
.fm-warn { font-style: normal; font-size: 11px; color: var(--warn); margin-left: 4px; }
.fm-danger:hover { color: #fca5a5; background: rgba(239,68,68,.1); }
:root[data-theme="light"] .fm-danger:hover { color: #b91c1c; }

/* ===================================================================== ajustes do celular */
@media (max-width: 960px) {
  /* campos com 16px: o iPhone não dá zoom sozinho ao tocar para digitar */
  input, select, textarea, .input { font-size: 16px !important; }
  html, body { overflow-x: hidden; max-width: 100%; touch-action: manipulation; }
  /* nome do contato mais abaixo, longe do desfoque da barra de status do iPhone */
  .pt-head { padding-top: calc(env(safe-area-inset-top, 0px) + 18px); min-height: calc(70px + env(safe-area-inset-top, 0px)); background: var(--surface); }
  /* teclado aberto: campo de mensagem encostado no teclado, como no WhatsApp */
  body.kb-open .composer { padding-bottom: 6px !important; }
  .pt-msgs { overflow-x: hidden; }
}

/* mosaico de fotos (álbum) */
.bubble.album { padding: 4px 4px 6px; }
.bubble.album > b { padding: 2px 6px 4px; }
.album-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: min(300px, 64vw); }
.album-tile { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: rgba(0,0,0,.2); }
.album-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-tile .wa-media-st { display: grid; place-items: center; height: 100%; padding: 0; }
.album-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10,0,24,.55); color: #fff; font-size: 26px; font-weight: 700; }
.bubble.album time { padding: 0 6px; }

/* visualizador de fotos */
.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(8,0,20,.94); animation: fm-in .15s ease; }
.lightbox img { max-width: 94vw; max-height: 82vh; object-fit: contain; border-radius: 6px; user-select: none; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px; color: #fff; }
.lb-count { flex: 1; font-weight: 600; font-size: var(--fs-sm); }
.lb-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; text-decoration: none !important; }
.lb-btn:hover { background: rgba(255,255,255,.2); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.lb-nav[hidden] { display: none; }
.lb-prev { left: 14px; } .lb-next { right: 14px; }
@media (hover: none) { .lb-nav { display: none; } }
.album-tile img { position: absolute; inset: 0; }


/* atendente IA */
.ai-badge { flex: none; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: rgba(124,58,237,.18); color: #c4b5fd; border: 1px solid rgba(124,58,237,.35); white-space: nowrap; text-decoration: none !important; }
:root[data-theme="light"] .ai-badge { color: #5b21b6; background: rgba(124,58,237,.1); }
@media (max-width: 960px) { .pt-head .ai-badge { font-size: 11px; padding: 3px 8px; } }
.switch-row { display: flex; align-items: center; gap: 12px; margin-bottom: var(--space-4); cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-row .switch { flex: none; width: 46px; height: 26px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .2s; }
.switch-row .switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch-row input:checked + .switch { background: var(--ok); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-row small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.tag-wa { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: rgba(37,211,102,.15); color: #86efac; vertical-align: middle; }
:root[data-theme="light"] .tag-wa { color: #15803d; }

/* player: ondinhas e progresso */
.vp-track { position: relative; }
.vp-line .vp-fill { width: 100% !important; clip-path: inset(0 100% 0 0); }
.vp-wave { flex: 1; height: 34px; padding: 0; background: none; cursor: pointer; min-width: 0; }
.vp-wave { overflow: hidden; }
.vp-wave .vp-bars { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; gap: 1px; }
.vp-wave .vp-bars i { flex: 0 1 2.5px; min-width: 1.5px; border-radius: 2px; background: rgba(196,170,255,.35); }
.vp-wave .vp-fill { position: absolute; inset: 0; top: 0; height: auto; width: 100% !important; background: none; border-radius: 0; clip-path: inset(0 100% 0 0); }
.vp-wave .vp-fill .vp-bars i { background: var(--brand); }
.bubble:not(.mine) .vp-wave .vp-fill .vp-bars i { background: #c4b5fd; }
:root[data-theme="light"] .vp-wave .vp-bars i { background: rgba(62,10,108,.25); }
:root[data-theme="light"] .bubble:not(.mine) .vp-wave .vp-fill .vp-bars i { background: #7c3aed; }
.vplayer.playing .vp-play { box-shadow: 0 0 0 3px rgba(207,161,80,.25); }

/* foto de perfil do WhatsApp nos avatares */
.avatar { position: relative; overflow: hidden; }
.avatar .av-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; background: var(--surface-2); }

/* celular: conversa aberta não deixa a página de trás rolar (evita o arrasto "invertido") */
@media (max-width: 960px) {
  html:has(body.thread-open) { overflow: hidden; height: 100%; overscroll-behavior: none; }
  body.thread-open { overflow: hidden; height: 100%; overscroll-behavior: none; }
  body.thread-open .pt-msgs { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}

/* ======================================================================
   FUNIL — quadro no estilo Monday (kanban, tabela, painel, cartão lateral)
   ====================================================================== */
.board { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.b-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.b-pipe { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 8px 4px 0; color: var(--text); cursor: pointer; border-radius: 8px; }
.b-pipe h1 { margin: 0; font-size: var(--fs-2xl); }
.b-pipe:hover { background: var(--surface-2); }
.b-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.b-sp { flex: 1; }
.b-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.b-tabs::-webkit-scrollbar { display: none; }
.b-tabs button { background: none; border: 0; padding: 9px 12px; font: 600 var(--fs-sm) var(--font-body); color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.b-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.b-tabs button:hover { color: var(--text); }
.b-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.b-search { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); min-width: 180px; }
.b-search input { border: 0; background: none; color: var(--text); font: inherit; font-size: var(--fs-sm); outline: none; width: 100%; min-width: 0; }
.b-tool { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text-2); font: 500 var(--fs-sm) var(--font-body); cursor: pointer; }
.b-tool:hover { background: var(--surface-2); color: var(--text); }
.b-tool.on { background: rgba(87,155,252,.14); color: var(--text); border-color: rgba(87,155,252,.4); }
.b-dist { display: flex; gap: 2px; width: 160px; height: 22px; border-radius: 6px; overflow: hidden; }
.b-dist i { display: block; min-width: 4px; }
.b-h3 { font-size: var(--fs-base); margin: 18px 0 8px; }
.b-link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }

/* avatares e etiquetas */
.b-av { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 10.5px/1 var(--font-body); color: #fff; letter-spacing: .02em; }
.b-av.sm { width: 22px; height: 22px; font-size: 9.5px; }
.b-av.none { background: var(--surface-3); color: var(--muted); border: 1px dashed var(--border-strong); }
.b-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 7px; border-radius: 4px; font-size: 12px; font-weight: 600; line-height: 1.5; color: var(--text); background: var(--surface-2); border-left: 3px solid var(--c, var(--border-strong)); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.b-chip.val { --c: transparent; border-left-color: transparent; font-variant-numeric: tabular-nums; }
.b-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* menus suspensos */
.b-pop { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow), 0 4px 18px rgba(0,0,0,.25); padding: 6px; max-width: min(320px, calc(100vw - 16px)); max-height: min(70vh, 520px); overflow: auto; animation: bpop .12s ease-out; }
@keyframes bpop { from { opacity: 0; transform: translateY(-4px); } }
.b-menu { display: flex; flex-direction: column; min-width: 220px; }
.b-menu button, .b-menu a { display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; color: var(--text); font: 500 var(--fs-sm) var(--font-body); cursor: pointer; }
.b-menu button:hover, .b-menu a:hover { background: var(--surface-2); }
.b-menu button.cur { background: rgba(87,155,252,.14); }
.b-menu button.sub::after { content: '›'; margin-left: auto; color: var(--muted); font-size: 18px; line-height: 1; }
.b-menu button .muted { margin-left: auto; font-size: var(--fs-xs); }
.b-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.b-menu-h { display: block; padding: 6px 10px 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.b-colors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 8px 10px; }
.b-colors button { width: 100%; aspect-ratio: 1; border-radius: 6px; border: 2px solid transparent; padding: 0; cursor: pointer; }
.b-colors button.cur { border-color: var(--text); }
.b-filt { display: flex; flex-direction: column; gap: 10px; padding: 6px; width: 300px; max-width: 100%; }
.b-pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px; }
.b-pills button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: none; color: var(--text-2); padding: 5px 10px; border-radius: 99px; font: 500 12.5px var(--font-body); cursor: pointer; }
.b-pills button.cur { background: rgba(87,155,252,.16); border-color: #579bfc; color: var(--text); }

/* kanban */
.kb-board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding: 2px 2px 14px; min-height: 60vh; scroll-snap-type: x proximity; }
.kb-col { flex: 0 0 272px; display: flex; flex-direction: column; background: var(--surface-2); border-radius: 10px; max-height: calc(100dvh - 250px); min-height: 160px; scroll-snap-align: start; transition: box-shadow .15s; }
.kb-col.over { box-shadow: 0 0 0 2px var(--c); }
.kb-colhead { display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 12px; background: var(--c); color: #fff; border-radius: 10px 10px 0 0; min-height: 42px; }
.kb-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.15); }
.kb-count { font-weight: 600; opacity: .9; font-size: 13.5px; }
.kb-max { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 5px; background: rgba(0,0,0,.18); white-space: nowrap; }
.kb-max.over { background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); }
.kb-ic { flex: none; width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: #fff; font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.kb-ic:hover { background: rgba(0,0,0,.18); }
.kb-sum { padding: 6px 12px 0; font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.kb-cards { display: flex; flex-direction: column; gap: 8px; padding: 8px; overflow-y: auto; flex: 1; min-height: 60px; }
.kb-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 6px; border: 1.5px dashed var(--border-strong); border-radius: 8px; }
.kb-drop { height: 4px; border-radius: 4px; background: var(--c); margin: -2px 0; }
.kb-col.collapsed { flex: 0 0 46px; min-height: 260px; background: var(--c); cursor: pointer; }
.kb-col.collapsed .kb-colhead { flex-direction: column; writing-mode: vertical-rl; height: 100%; min-height: 240px; padding: 12px 0; border-radius: 10px; }
.kb-addcol { flex: 0 0 120px; height: 42px; border: 1.5px dashed var(--border-strong); border-radius: 10px; background: none; color: var(--text-2); font: 600 var(--fs-sm) var(--font-body); cursor: pointer; }
.kb-addcol:hover { color: var(--text); border-color: var(--text-2); }

.kb-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 10px 8px; display: flex; flex-direction: column; gap: 7px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.12); transition: box-shadow .12s, transform .12s, border-color .12s; }
.kb-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.22); border-color: var(--border-strong); }
.kb-card.dragging { opacity: .35; transform: rotate(1.5deg); }
.kb-ct { display: flex; align-items: flex-start; gap: 6px; }
.kb-title { flex: 1; min-width: 0; }
.kb-title strong { display: block; font-size: 14px; line-height: 1.35; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.kb-title small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.kb-more { flex: none; width: 26px; height: 22px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s; }
.kb-card:hover .kb-more, .kb-card:focus-within .kb-more { opacity: 1; }
@media (hover: none) { .kb-more { opacity: 1; } }
.kb-more:hover { background: var(--surface-2); color: var(--text); }
.kb-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.kb-wa { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; border: 0; background: var(--surface-2); border-radius: 6px; padding: 6px 8px; color: var(--text-2); font: 12.5px/1.35 var(--font-body); cursor: pointer; }
.kb-wa:hover { background: var(--surface-3); }
.kb-wa-ic { color: #25d366; flex: none; display: grid; }
.kb-wa-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-wa small { flex: none; color: var(--muted); font-size: 11px; }
.kb-wa b { flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #25d366; color: #fff; font-size: 11px; display: grid; place-items: center; }
.kb-wa.unread .kb-wa-t { color: var(--text); font-weight: 600; }
.kb-task { font-size: 12px; color: var(--text-2); }
.kb-task.late { color: #ff7575; font-weight: 600; }
.kb-foot { display: flex; align-items: center; gap: 8px; }
.kb-src { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-ico { display: inline-flex; align-items: center; gap: 3px; color: var(--text-2); font-size: 12px; }
.kb-ico em { font-style: normal; font-weight: 600; }
.kb-ico.dim { color: var(--muted); opacity: .55; }
.kb-ico.ok { color: #00c875; }

/* tabela agrupada */
.bt-wrap { display: flex; flex-direction: column; gap: 22px; }
.bt-group h3 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-base); color: var(--c); margin: 0 0 8px; }
.bt-group h3 i { width: 4px; height: 18px; border-radius: 2px; background: var(--c); }
.bt-group h3 small { color: var(--muted); font-weight: 500; font-size: var(--fs-xs); }
.bt-group .table-wrap { border-left: 4px solid var(--c); }
.bt-open { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; display: flex; flex-direction: column; }
.bt-open:hover .subject { text-decoration: underline; }
.bt-sel, .bt-in { background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--text); font: inherit; font-size: var(--fs-sm); padding: 5px 6px; max-width: 170px; }
.bt-sel:hover, .bt-in:hover, .bt-sel:focus, .bt-in:focus { border-color: var(--border-strong); background: var(--surface); }
.bt-sel option { background: var(--surface); color: var(--text); }
.bt-in { width: 100px; font-variant-numeric: tabular-nums; }
.bt-prio { display: inline-block; border-left: 3px solid var(--c); border-radius: 4px; background: var(--surface-2); }
.bt-wa { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--text-2); cursor: pointer; font-size: var(--fs-xs); text-align: left; padding: 0; }
.bt-wa svg { color: #25d366; flex: none; }
.bt-wa.unread { color: var(--text); font-weight: 600; }
.bt-wa b { background: #25d366; color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; }

/* minhas tarefas */
.b-mine-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.b-todo h3 { font-size: var(--fs-base); display: flex; gap: 8px; align-items: baseline; }
.b-todo h3 small { color: var(--muted); font-weight: 500; }
.b-todo ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.b-todo li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); }
.b-todo li .check { margin: 0; flex: 1 1 200px; }
.b-todo li small { color: var(--muted); }
.b-todo li.late small { color: #ff7575; font-weight: 600; }
.b-todo li.done span { text-decoration: line-through; color: var(--muted); }

/* painel de números */
.bs { display: flex; flex-direction: column; gap: 16px; }
.bs-period { display: flex; align-items: center; gap: 10px; }
.bs-period label { color: var(--text-2); font-size: var(--fs-sm); }
.bs-period .input { width: auto; }
.bs-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.bs-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.bs-tile small { color: var(--text-2); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.bs-tile strong { font: 700 28px/1.1 var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }
.bs-tile span { color: var(--muted); font-size: var(--fs-xs); }
.bs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.bs-grid h3 { font-size: var(--fs-base); }
.bs-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto auto; gap: 10px; align-items: center; padding: 5px 0; font-size: var(--fs-sm); }
.bs-l { display: flex; align-items: center; gap: 6px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-bar { height: 12px; background: var(--surface-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.bs-bar i { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.bs-row b { font-variant-numeric: tabular-nums; color: var(--text); }
.bs-row em { font-style: normal; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }

/* editor de funil */
.pe-lbl { display: block; font-weight: 600; font-size: var(--fs-sm); margin: 8px 0; }
.pe-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pe-row { display: grid; grid-template-columns: 38px 1fr 130px 64px auto; gap: 6px; align-items: center; }
.pe-row input[type="color"] { width: 38px; height: 38px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: none; cursor: pointer; }
.pe-row .input { min-height: 38px; padding: 6px 10px; }
.pe-btns { display: flex; gap: 2px; }
.pe-btns button { width: 30px; height: 34px; border: 0; border-radius: 6px; background: var(--surface-2); color: var(--text-2); cursor: pointer; }
.pe-btns button:disabled { opacity: .35; cursor: default; }
@media (max-width: 560px) { .pe-row { grid-template-columns: 38px 1fr 64px; } .pe-row select { grid-column: 2; } .pe-btns { grid-column: 3; grid-row: 2; } }

/* cartão aberto (painel lateral) */
body.dw-open { overflow: hidden; }
.dw-back { position: fixed; inset: 0; z-index: 60; background: rgba(8, 2, 20, .45); opacity: 0; transition: opacity .2s; }
.dw-back.in { opacity: 1; }
.dw { position: fixed; z-index: 61; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--bg); border-left: 1px solid var(--border-strong); box-shadow: -20px 0 50px rgba(0,0,0,.35); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease-out; overflow: hidden; }
.dw.in { transform: none; }
.dw-head { display: flex; align-items: flex-start; gap: 8px; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 10px 20px; }
.dw-t { flex: 1; min-width: 0; }
.dw-t h2 { margin: 0; font-size: var(--fs-xl); overflow-wrap: anywhere; }
.dw-t small { color: var(--muted); font-size: var(--fs-xs); }
.dw-x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 16px; cursor: pointer; display: grid; place-items: center; text-decoration: none; }
.dw-x:hover { color: var(--text); background: var(--surface-3); }
.dw-stages { display: flex; gap: 3px; padding: 0 20px 12px; overflow-x: auto; scrollbar-width: none; flex: none; }
.dw-stages::-webkit-scrollbar { display: none; }
.dw-stages button { flex: 1 0 auto; min-width: 72px; border: 0; padding: 7px 10px; background: var(--surface-2); color: var(--text-2); font: 600 12px var(--font-body); cursor: pointer; white-space: nowrap; border-bottom: 3px solid var(--c); }
.dw-stages button:first-child { border-radius: 6px 0 0 6px; }
.dw-stages button:last-child { border-radius: 0 6px 6px 0; }
.dw-stages button.on { background: var(--c); color: #fff; }
.dw-stages button:hover:not(.on) { color: var(--text); background: var(--surface-3); }
.lead-stages { padding: 0 0 16px; }
.dw-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 0 20px 10px; flex: none; }
.dw-meta label, .dw-tags { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; min-width: 0; }
.dw-meta .input { min-height: 36px; padding: 5px 10px; font-size: var(--fs-sm); text-transform: none; letter-spacing: 0; }
.dw-tags { grid-column: 1 / -1; }
.dw-tagbox { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-height: 36px; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); text-transform: none; letter-spacing: 0; }
.dw-tagin { border: 0; background: none; color: var(--text); font: inherit; font-size: var(--fs-sm); outline: none; flex: 1; min-width: 90px; padding: 4px; }
.dw-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 20px 12px; flex: none; }
.dw-won { border-color: rgba(0,200,117,.5) !important; }
.dw-lost { border-color: rgba(127,140,155,.6) !important; }
.dw-tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; scrollbar-width: none; }
.dw-tabs button { background: none; border: 0; padding: 10px 10px; font: 600 var(--fs-sm) var(--font-body); color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.dw-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.dw-tabs b { background: #25d366; color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; }
.dw-tabs small { color: var(--muted); font-weight: 500; }
.dw-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.dw-pad { padding: 14px 20px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.dw-conv { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.dw-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.dw-convlink { position: absolute; top: 8px; right: 14px; z-index: 3; font-size: 12px; background: var(--surface); border: 1px solid var(--border); padding: 3px 10px; border-radius: 99px; }
.dw-conv .composer { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
.dw-prog { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 4px; }
.dw-prog i { display: block; height: 100%; background: #00c875; border-radius: 99px; transition: width .2s; }
.dw-subs { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; }
.dw-subs li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.dw-subs li .check { flex: 1; margin: 0; min-width: 0; }
.dw-subs li .check span { overflow-wrap: anywhere; }
.dw-subs li.done .check span { text-decoration: line-through; color: var(--muted); }
.dw-subs small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.dw-subs small.late { color: #ff7575; font-weight: 600; }
.dw-sowner { background: transparent; border: 1px solid transparent; color: var(--text-2); border-radius: 6px; font-size: 12px; padding: 3px; max-width: 110px; }
.dw-sowner:hover { border-color: var(--border-strong); }
.dw-sowner option { background: var(--surface); color: var(--text); }
.dw-del { border: 0; background: none; color: var(--muted); cursor: pointer; width: 26px; height: 26px; border-radius: 6px; }
.dw-del:hover { background: var(--surface-2); color: #ff7575; }
.dw-addsub { display: grid; grid-template-columns: 1fr 150px auto; gap: 6px; }
.dw-addsub .input { min-height: 38px; padding: 6px 10px; }
.dw-coms { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.dw-coms li { display: flex; gap: 10px; align-items: flex-start; }
.dw-coms li > div { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.dw-coms small { color: var(--muted); font-size: 11.5px; }
.dw-coms small b { color: var(--text-2); }
.dw-coms p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); }
.dw-addcom { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.dw-addcom textarea { width: 100%; }

@media (max-width: 760px) {
  .b-pipe h1 { font-size: var(--fs-xl); }
  .b-head-actions { margin-left: 0; width: 100%; }
  .b-head-actions .btn-primary { flex: 1; }
  .b-search { flex: 1 1 100%; }
  .b-tool { padding: 0 9px; }
  .b-dist { width: 100%; height: 8px; order: 9; }
  .kb-board { min-height: 0; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 14px; scroll-padding: 0 16px; }
  .kb-col { flex-basis: 84vw; max-height: none; }
  .kb-cards { overflow: visible; }
  .dw { width: 100vw; border-left: 0; }
  .dw-meta { grid-template-columns: 1fr 1fr; padding: 0 16px 10px; }
  .dw-head, .dw-stages, .dw-actions { padding-left: 16px; padding-right: 12px; }
  .dw-pad { padding: 12px 16px 20px; }
  .dw-addsub { grid-template-columns: 1fr auto; }
  .dw-addsub input[type="date"] { grid-column: 1; grid-row: 2; }
  .bs-row { grid-template-columns: minmax(80px, 110px) 1fr auto; }
  .bs-row em { display: none; }
  .bt-sel { max-width: 60vw; }
}

/* tema claro */
:root[data-theme="light"] .kb-col { background: #ece6f4; }
:root[data-theme="light"] .kb-card { box-shadow: 0 1px 3px rgba(30,6,58,.10); }
:root[data-theme="light"] .kb-card:hover { box-shadow: 0 6px 18px rgba(30,6,58,.16); }
:root[data-theme="light"] .b-pop { box-shadow: 0 12px 34px rgba(30,6,58,.2); }
:root[data-theme="light"] .dw-back { background: rgba(30,6,58,.28); }
:root[data-theme="light"] .dw { box-shadow: -18px 0 44px rgba(30,6,58,.18); }
:root[data-theme="light"] .b-chip { background: #f3eef9; }
:root[data-theme="light"] .kb-task.late, :root[data-theme="light"] .b-todo li.late small, :root[data-theme="light"] .dw-subs small.late { color: #c42c43; }
.b-mine-list > .card, .bs-grid > .card { margin: 0; }
.board[data-tab="painel"] .b-toolbar { display: none; }
@media (min-width: 761px) {
  .bt { table-layout: fixed; }
  .bt th:nth-child(1) { width: 19%; } .bt th:nth-child(2) { width: 14%; } .bt th:nth-child(3) { width: 14%; }
  .bt th:nth-child(4) { width: 11%; } .bt th:nth-child(5) { width: 9%; } .bt th:nth-child(6) { width: 13%; }
  .bt th:nth-child(7) { width: 13%; } .bt th:nth-child(8) { width: 7%; }
  .bt .bt-sel { width: 100%; max-width: none; }
  .bt td { overflow: hidden; }
}
.pe-row { grid-template-columns: 38px 1fr 150px 64px auto; }
@media (max-width: 560px) { .pe-row { grid-template-columns: 38px 1fr 64px; } }
.kb-col.collapsed { height: 280px; min-height: 0; }
.kb-col.collapsed .kb-colhead { min-height: 0; }
@media (min-width: 761px) { .bt th:nth-child(1) { width: 17%; } .bt th:nth-child(8) { width: 9%; } }

/* ---------------- barras de rolagem na identidade visual (todas as áreas) ---------------- */
* { scrollbar-width: thin; scrollbar-color: rgba(196,170,255,.25) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: rgba(196,170,255,.25); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(196,170,255,.45); }
*::-webkit-scrollbar-track, *::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
:root[data-theme="light"] * { scrollbar-color: rgba(62,10,108,.2) transparent; }
:root[data-theme="light"] *::-webkit-scrollbar-thumb { background: rgba(62,10,108,.2); }
:root[data-theme="light"] *::-webkit-scrollbar-thumb:hover { background: rgba(62,10,108,.35); }

/* áreas que rolam para os lados: sem barra, arrasta com o mouse */
.drag-x, .table-wrap { scrollbar-width: none; }
.drag-x::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { display: none; }
@media (pointer: fine) {
  .kb-board.drag-x { cursor: grab; }
  .kb-board.drag-x .kb-card { cursor: pointer; }
  .kb-board.drag-x button { cursor: pointer; }
  .drag-x.dragging-x, .drag-x.dragging-x * { cursor: grabbing !important; user-select: none; }
}
.drag-x.dragging-x { scroll-snap-type: none; }

/* efeito elástico no fim da rolagem */
.ob > * { transform: translate3d(var(--obx, 0px), var(--oby, 0px), 0); transition: transform .42s cubic-bezier(.18, .89, .32, 1.15); }
.ob.ob-pulling > * { transition: transform .08s linear; }

/* Kanban: a página cabe na tela; só a lista de cartões de cada coluna rola (e o quadro, para os lados) */
.app > div:has(.board[data-tab="kanban"]) { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.app > div:has(.board[data-tab="kanban"]) .main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: clamp(.75rem, 1.5vw, 1.25rem); }
.main:has(.board[data-tab="kanban"]) .main-inner { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; }
.main:has(.board[data-tab="kanban"]) #view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.board[data-tab="kanban"] { flex: 1; min-height: 0; }
.board[data-tab="kanban"] #b-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.board[data-tab="kanban"] .kb-board { flex: 1; min-height: 0; padding-bottom: 4px; }
.board[data-tab="kanban"] .kb-col { max-height: 100%; }
.board[data-tab="kanban"] .kb-col.collapsed { max-height: 280px; }
.board[data-tab="kanban"] .kb-cards { overflow-y: auto; overscroll-behavior: contain; }
html:has(.board[data-tab="kanban"]), body:has(.board[data-tab="kanban"]) { overflow: hidden; overscroll-behavior: none; }
@media (max-width: 760px) {
  .board[data-tab="kanban"] { gap: 8px; }
  .board[data-tab="kanban"] .b-head-actions #b-edit { display: none; }
  .board[data-tab="kanban"] .b-head { flex-wrap: nowrap; }
  .board[data-tab="kanban"] .b-head-actions { width: auto; margin-left: auto; }
  .board[data-tab="kanban"] .b-search { flex: 1 1 120px; min-width: 0; }
  .board[data-tab="kanban"] .b-tool span { display: none; }
  .board[data-tab="kanban"] .b-tool.on span { display: inline; }
  .board[data-tab="kanban"] .kb-board { padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
}
@media (pointer: fine) and (min-width: 761px) { .kb-board { scroll-snap-type: none; } }
.dash-tabs { margin: -8px 0 var(--space-4); }
.bs-period { flex-wrap: wrap; }

/* arco de luz suave na borda em que a rolagem acabou */
.ob-glow { position: fixed; z-index: 70; pointer-events: none; opacity: 0; transition: opacity .12s linear, width .08s linear, height .08s linear; --g: 196, 170, 255; }
.ob-glow.out { transition: opacity .42s ease-out, width .42s ease-out, height .42s ease-out; }
.ob-l { border-radius: 0 100% 100% 0 / 0 50% 50% 0; background: radial-gradient(ellipse 100% 50% at 0 50%, rgba(var(--g), .09), rgba(var(--g), .03) 60%, transparent 100%); }
.ob-r { border-radius: 100% 0 0 100% / 50% 0 0 50%; background: radial-gradient(ellipse 100% 50% at 100% 50%, rgba(var(--g), .09), rgba(var(--g), .03) 60%, transparent 100%); }
.ob-t { border-radius: 0 0 50% 50% / 0 0 100% 100%; background: radial-gradient(ellipse 50% 100% at 50% 0, rgba(var(--g), .09), rgba(var(--g), .03) 60%, transparent 100%); }
.ob-b { border-radius: 50% 50% 0 0 / 100% 100% 0 0; background: radial-gradient(ellipse 50% 100% at 50% 100%, rgba(var(--g), .09), rgba(var(--g), .03) 60%, transparent 100%); }
:root[data-theme="light"] .ob-glow { --g: 62, 10, 108; }

/* fluidez: entradas suaves, esqueleto de carregamento, cartões novos */
#b-body { transition: opacity .18s ease; }
.board.is-loading #b-body { opacity: .5; pointer-events: none; }
#b-body.b-in { animation: bIn .22s ease-out; }
@keyframes bIn { from { opacity: 0; transform: translateY(4px); } }
.kb-card.kb-new { animation: kbNew .28s ease-out; }
@keyframes kbNew { from { opacity: 0; transform: scale(.97); } }
.dw-skel { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dw-skel i { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: skel 1.1s linear infinite; }
.dw-skel i:nth-child(2) { width: 80%; } .dw-skel i:nth-child(3) { width: 60%; } .dw-skel i:nth-child(4) { width: 70%; }
@keyframes skel { to { background-position: -200% 0; } }
.dw-body.tab-in > * { animation: bIn .18s ease-out; }
@media (prefers-reduced-motion: reduce) { #b-body.b-in, .kb-card.kb-new, .dw-body.tab-in > *, .dw-skel i { animation: none; } }

/* importar / exportar leads */
dialog.modal.modal-wide { width: min(760px, calc(100% - 24px)); }
.im-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 34px 18px; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.im-drop:hover, .im-drop.over { border-color: var(--brand); background: rgba(207,161,80,.06); }
.im-drop.busy { opacity: .7; pointer-events: none; }
.im-drop small { color: var(--muted); font-size: var(--fs-xs); }
.im-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 20px; color: var(--brand); }
.im-drop.busy .im-ico { animation: skel 1s linear infinite; }
.im-sum { margin-bottom: 4px; }
.im-h { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: 18px 0 8px; }
.im-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; padding: 2px; }
.im-col { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.im-col strong { display: block; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.im-col small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.im-col .input { min-height: 34px; padding: 4px 8px; font-size: var(--fs-sm); }
.im-radios .check { margin-bottom: 6px; }
.im-prev { max-height: 220px; overflow: auto; }
.im-prev .table td, .im-prev .table th { padding: 6px 10px; font-size: var(--fs-xs); }
.im-done { text-align: center; padding: 6px 0; }
.im-big { font-size: 40px; margin-bottom: 10px; }
.im-res { text-align: left; margin-bottom: 12px; }
.im-err { text-align: left; font-size: var(--fs-xs); color: var(--text-2); }
@media (max-width: 760px) { .b-hide-m { display: none !important; } .im-prev .table td::before { display: none; } }
@media (pointer: fine) {
  .drag-y { cursor: grab; }
  .drag-y .wa-text, .drag-y .bubble > div:not([class]) { cursor: text; }
  .drag-y a, .drag-y button, .drag-y img, .drag-y .vplayer, .drag-y [data-goto], .drag-y .wa-quote { cursor: pointer; }
}
.sync-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.sync-row > div { flex: 1; }

/* tracinhos de confirmação e dados da mensagem */
.bubble.pending { opacity: 1; }
.bubble time { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.tk-btn { display: inline-flex; align-items: center; border: 0; background: none; padding: 0 0 0 2px; margin: 0; color: inherit; cursor: pointer; line-height: 1; }
.tk { color: var(--muted); }
.tk-read { color: #53bdeb; }
.tk-wait { color: var(--muted); opacity: .9; }
.tk-fail { color: #ff6b6b; font-size: 13px; }
.msg-fail { margin-top: 6px; font-size: 12px; color: #ff8a8a; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.msg-fail button { border: 1px solid rgba(255,138,138,.5); background: none; color: inherit; border-radius: 99px; padding: 2px 10px; font: 600 11.5px var(--font-body); cursor: pointer; }
.mi-preview { display: flex; justify-content: flex-end; padding: 14px; border-radius: 12px; background: var(--bg-2); margin-bottom: 14px; max-height: 260px; overflow: auto; }
.mi-preview .bubble { max-width: 100%; }
.mi-preview .tk-btn { pointer-events: none; }
.mi-list { display: flex; flex-direction: column; gap: 2px; }
.mi-row { display: flex; align-items: center; gap: 14px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.mi-row:last-child { border-bottom: 0; }
.mi-row .tk { flex: none; width: 20px; }
.mi-row strong { display: block; font-size: var(--fs-sm); }
.mi-row small { color: var(--text-2); font-size: var(--fs-xs); }
:root[data-theme="light"] .tk-read { color: #1f9ad6; }

/* chat da equipe no estilo WhatsApp */
.mention { color: #53bdeb; font-weight: 600; }
.bubble.mine .mention { color: #f2d39a; }
.bubble.mention-me { box-shadow: inset 3px 0 0 #53bdeb; }
.bubble.deleted .del-txt { font-style: italic; color: var(--muted); }
.reacts span small { font-size: 10.5px; margin-left: 2px; color: var(--text-2); }
.mention-pop { position: absolute; left: 10px; right: 10px; bottom: calc(100% + 6px); z-index: 30; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; max-height: 260px; overflow: auto; }
.mention-pop[hidden] { display: none; }
.mention-pop button { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; color: var(--text); padding: 8px 10px; border-radius: 8px; font: 500 var(--fs-sm) var(--font-body); cursor: pointer; }
.mention-pop button.on, .mention-pop button:hover { background: var(--surface-2); }
.composer { position: relative; }
#room-sub.typing { color: #25d366; font-style: italic; }
.ci-h { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: 14px 0 4px; }
.wa-doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.18); color: inherit; text-decoration: none; min-width: 200px; }
.wa-doc span:not(.wa-doc-ic) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: var(--fs-sm); }
.wa-doc small { color: var(--muted); font-size: 11px; }
.wa-doc-ic { font-size: 22px; }
:root[data-theme="light"] .wa-doc { background: rgba(62,10,108,.06); }
:root[data-theme="light"] .mention { color: #1f7fc2; }
.wa-doc-ic { flex: none !important; }
.mi-preview .msg-tools, .mi-preview .reacts { display: none; }
.tk-btn:focus:not(:focus-visible) { outline: none; }
.kb-ph { flex: none; width: 32px; height: 32px; font-size: 12px; margin-top: 1px; }
.dw-ph { flex: none; width: 44px; height: 44px; font-size: 15px; }
.bt-open { flex-direction: row !important; align-items: center; gap: 10px; }
.bt-nm { display: flex; flex-direction: column; min-width: 0; }
.bt-ph { flex: none; width: 30px; height: 30px; font-size: 11px; }
.lp-ph { width: 46px; height: 46px; font-size: 16px; }
.ticket-pop button { align-items: flex-start; }
.tp-h { padding: 4px 10px 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.tp-id { flex: none; color: var(--brand); font-variant-numeric: tabular-nums; min-width: 38px; }
.tp-main { display: flex; flex-direction: column; min-width: 0; }
.tp-main span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-main small { color: var(--muted); font-size: 11.5px; }
.tp-empty { padding: 10px; color: var(--muted); font-size: var(--fs-sm); }

/* revisão dos contatos antes de importar */
dialog.modal.modal-xl { width: min(1180px, calc(100% - 20px)); }
.rv-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.rv-tabs { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.rv-tabs button { border: 1px solid var(--border-strong); background: none; color: var(--text-2); padding: 6px 12px; border-radius: 99px; font: 600 12.5px var(--font-body); cursor: pointer; }
.rv-tabs button b { margin-left: 4px; font-weight: 700; color: var(--text); }
.rv-tabs button.on { background: rgba(87,155,252,.16); border-color: #579bfc; color: var(--text); }
.rv-search { min-width: 220px; }
.rv-bulk { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 8px; font-size: var(--fs-sm); }
.rv-bulk .check { margin: 0; }
.rv-wrap { max-height: min(58vh, 560px); overflow: auto; }
.rv-table { min-width: 900px; }
.rv-table th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.rv-table td { padding: 4px 6px; vertical-align: middle; }
.rv-table tr.off td { opacity: .5; }
.rv-table tr.off td:first-child { opacity: 1; }
.rv-in { width: 100%; min-width: 90px; border: 1px solid transparent; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-sm); padding: 6px 8px; border-radius: 6px; }
.rv-in:hover { border-color: var(--border); }
.rv-in:focus { border-color: var(--brand); background: var(--surface-2); outline: none; }
.rv-st { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.rv-st.ok { background: rgba(0,200,117,.15); color: #3ddc97; }
.rv-st.warn { background: rgba(253,171,61,.15); color: #fdab3d; }
.rv-st.bad { background: rgba(226,68,92,.15); color: #ff7b8f; }
.rv-warn { display: block; color: #fdab3d; font-size: 11px; margin-top: 2px; }
.rv-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; font-size: var(--fs-sm); }
:root[data-theme="light"] .rv-st.ok { color: #0a8f55; } :root[data-theme="light"] .rv-st.warn { color: #a5650a; } :root[data-theme="light"] .rv-st.bad { color: #c42c43; }
@media (max-width: 760px) {
  .rv-table { min-width: 0; }
  .rv-table thead { display: none; }
  .rv-table tr { position: relative; padding: 10px 12px 10px 40px; }
  .rv-table td:first-child { position: absolute; left: 10px; top: 12px; padding: 0; }
  .rv-table td:nth-child(2) { display: none; }
  .rv-table td { padding: 2px 0; }
  .rv-table td[data-label]::before { min-width: 70px; }
  .rv-table td:last-child { position: absolute; right: 6px; top: 6px; padding: 0; }
}
.rv-hint { font-size: var(--fs-xs); margin: 0 0 6px; }

/* tracinhos: ao passar o mouse viram um "i" de informação */
.tk-btn .tk-info { display: none; color: var(--text-2); }
@media (hover: hover) {
  button.tk-btn:hover .tk, button.tk-btn:hover .tk-fail { display: none; }
  button.tk-btn:hover .tk-info { display: inline-block; }
  button.tk-btn:hover .tk-info { color: var(--text); }
}
button.tk-btn:focus-visible .tk { display: none; }
button.tk-btn:focus-visible .tk-info { display: inline-block; }

/* mover etapas (⇔) e selecionar várias */
.kb-move { cursor: grab !important; opacity: .75; margin-left: -4px; }
.kb-move:hover { opacity: 1; }
.kb-move:active { cursor: grabbing !important; }
.kb-col.col-dragging { opacity: .4; }
.kb-col.drop-before { box-shadow: -4px 0 0 0 var(--brand); }
.kb-col.drop-after { box-shadow: 4px 0 0 0 var(--brand); }
.kb-sel { width: 18px; height: 18px; accent-color: #fff; flex: none; cursor: pointer; }
.board[data-tab="kanban"] .kb-col .kb-colhead { cursor: default; }
.kb-col.selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); }
.kb-bulkbar { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  padding: 10px 12px 10px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 12px 40px rgba(0,0,0,.45); max-width: calc(100vw - 24px); animation: bIn .2s ease-out; }
.kb-bulkbar strong { font-size: var(--fs-sm); margin-right: 4px; white-space: nowrap; }
.kb-bulk-sep { width: 1px; height: 22px; background: var(--border-strong); }
.kb-bulk-x { border: 0; background: var(--surface-2); color: var(--text-2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.kb-bulk-x:hover { color: var(--text); }
@media (max-width: 760px) { .kb-bulkbar { left: 12px; right: 12px; transform: none; justify-content: flex-start; } .kb-bulk-sep { display: none; } }
:root[data-theme="light"] .kb-bulkbar { box-shadow: 0 12px 36px rgba(30,6,58,.2); }
@media (min-width: 761px) { .kb-bulkbar { width: max-content; flex-wrap: nowrap; } }

/* seleção em área (clique duplo e segurar) */
.marquee { position: fixed; z-index: 90; pointer-events: none; border: 1px solid rgba(87,155,252,.9); background: rgba(87,155,252,.14); border-radius: 3px; }
.kb-card.picked { border-color: #579bfc; box-shadow: 0 0 0 2px #579bfc, 0 4px 14px rgba(0,0,0,.25); background: color-mix(in srgb, var(--surface) 88%, #579bfc); }
.kb-card.picked::after { content: '✓'; position: absolute; top: -7px; left: -7px; width: 20px; height: 20px; border-radius: 50%; background: #579bfc; color: #fff; font: 700 12px/20px var(--font-body); text-align: center; box-shadow: 0 0 0 2px var(--bg); }

/* ---------------- marca do cliente (SaaS) ---------------- */
.logo.brand-logo { object-fit: contain; object-position: left center; }
.sidebar .logo.brand-logo { height: 34px; max-width: 190px; margin-top: 0; }
.topbar .logo.brand-logo { height: 26px; max-width: 150px; }
.auth-card .logo.brand-logo { height: 84px; max-width: 260px; object-position: center; }
.logo.brand-text { display: block; font: 800 var(--fs-lg)/1.15 var(--font-display); color: var(--text); letter-spacing: -.01em; height: auto !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.topbar .logo.brand-text { font-size: var(--fs-base); max-width: 170px; }
.auth-card .logo.brand-text { text-align: center; font-size: var(--fs-2xl); max-width: none; white-space: normal; }

/* ---------------- assinatura: aviso de teste, bloqueio e módulos com cadeado ---------------- */
.sub-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 var(--space-4); padding: 10px 12px 10px 16px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); font-size: var(--fs-sm); color: var(--text-2);
}
.sub-banner > span { flex: 1 1 220px; }
.sub-banner strong { color: var(--text); }
.sub-banner.sub-info { box-shadow: inset 3px 0 0 var(--brand); }
.sub-banner.sub-warn { box-shadow: inset 3px 0 0 var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.sub-x { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.sub-x:hover { color: var(--text); background: var(--surface-2); }
.sub-block {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fm-in .2s ease;
}
.sub-card {
  width: min(460px, 100%); padding: 32px 28px; text-align: center; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.sub-card h2 { margin-bottom: 8px; }
.sub-card p { color: var(--text-2); }
.sub-card .muted { font-size: var(--fs-sm); color: var(--muted); }
.sub-actions { display: grid; gap: 8px; margin-top: var(--space-5); }
.sub-ico {
  width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 16px;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent);
}
.sub-ico svg { width: 26px; height: 26px; }
.upsell { max-width: 560px; margin: 6vh auto 0; text-align: center; }
.upsell ul { text-align: left; display: grid; gap: 8px; margin: var(--space-5) auto; padding: 0; list-style: none; max-width: 440px; }
.upsell li { position: relative; padding-left: 26px; color: var(--text-2); }
.upsell li::before { content: "✓"; position: absolute; left: 4px; color: var(--brand); font-weight: 700; }
.nav a.locked { opacity: .62; }
.nav a.locked .nav-lock { margin-left: auto; display: inline-flex; color: var(--muted); }
.nav a.locked .nav-lock svg { width: 14px; height: 14px; }
.nav a.locked:hover { opacity: 1; }

/* ---------- celular: entrar/sair da conversa deslizando ---------- */
.slide-ghost { position: fixed; inset: 0; z-index: 44; overflow: hidden; background: var(--bg); pointer-events: none; will-change: transform; --dim: 0; }
.slide-ghost::after { content: ""; position: absolute; inset: 0; background: #000; opacity: var(--dim); pointer-events: none; }
.slide-ghost > * { pointer-events: none; }
.slide-clone { position: fixed; z-index: 60; display: flex; flex-direction: column; overflow: hidden; pointer-events: none; box-shadow: -8px 0 24px rgba(0,0,0,.35); }
.pane.sliding { background: transparent; border-color: transparent; }
.pane.sliding .pane-thread { box-shadow: -8px 0 24px rgba(0,0,0,.35); will-change: transform; }
.avatar .av-img.av-wait { opacity: 0; }

/* ---------- celular: cada etapa do funil ocupa a largura da tela; "+ Etapa" vira uma coluna também ---------- */
@media (max-width: 760px) {
  .kb-board { gap: 12px; scroll-snap-type: x mandatory; scroll-padding: 0 16px; }
  .kb-col { flex: 0 0 100%; width: 100%; max-width: 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }
  .kb-col .kb-card { min-width: 0; max-width: 100%; }
  .kb-col.collapsed { flex: 0 0 52px; width: 52px; scroll-snap-stop: normal; }
  .kb-addcol { flex: 0 0 100%; width: 100%; height: 120px; scroll-snap-align: start; font-size: var(--fs-base); }
}

/* Kanban (computador): todas as etapas com a mesma largura padrão, o conteúdo nunca alarga a coluna */
@media (min-width: 761px) {
  .kb-col { flex: 0 0 300px; width: 300px; min-width: 0; max-width: 300px; }
  .kb-col.collapsed { flex: 0 0 46px; width: 46px; max-width: 46px; }
}
.kb-cards, .kb-card { min-width: 0; max-width: 100%; }
.kb-card { overflow: hidden; overflow-wrap: anywhere; }
.kb-card { flex-shrink: 0; }

/* logo do cliente em "bolinha" (como foto de perfil) + nome ao lado */
.logo.brand-badge { display: flex; align-items: center; gap: 10px; min-width: 0; height: auto !important; color: var(--text); text-decoration: none; }
.brand-badge .bb-dot { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 4px 14px rgba(0,0,0,.25); }
.brand-badge .bb-dot img { width: 78%; height: 78%; object-fit: contain; display: block; }
.brand-badge b { font: 800 var(--fs-base)/1.15 var(--font-display); letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .logo.brand-badge { margin: 0 var(--space-3) var(--space-6); max-width: 210px; }
.topbar .logo.brand-badge { gap: 8px; max-width: 190px; }
.topbar .brand-badge .bb-dot { width: 30px; height: 30px; }
.topbar .brand-badge b { font-size: var(--fs-sm); }
.auth-card .logo.brand-badge { flex-direction: column; gap: 12px; margin: 0 auto var(--space-6); text-align: center; }
.auth-card .brand-badge .bb-dot { width: 96px; height: 96px; box-shadow: 0 0 0 4px rgba(255,255,255,.08), 0 10px 30px rgba(0,0,0,.35); }
.auth-card .brand-badge b { font-size: var(--fs-xl); white-space: normal; }
:root[data-theme="light"] .brand-badge .bb-dot { box-shadow: 0 0 0 1px rgba(30,6,58,.12), 0 4px 14px rgba(30,6,58,.12); }

/* celular: arrastar cartão do funil segurando o dedo */
@media (pointer: coarse) {
  .kb-card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}
.kb-board.touch-dragging { scroll-snap-type: none !important; }
.kb-board.touch-dragging .kb-cards { scroll-behavior: auto; }
body.kb-touch-drag { -webkit-user-select: none; user-select: none; }
.kb-ghost { position: fixed; z-index: 1000; margin: 0; pointer-events: none; will-change: left, top, transform; transition: transform .16s cubic-bezier(.2,.8,.2,1), box-shadow .16s; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.kb-ghost.lift { transform: scale(1.04) rotate(-1.5deg); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.kb-ghost.land { transition: left .18s cubic-bezier(.2,.8,.2,1), top .18s cubic-bezier(.2,.8,.2,1), opacity .18s; opacity: 0; }
.kb-drag-label { position: fixed; z-index: 1001; pointer-events: none; transform: translate(-50%, -100%); padding: 5px 12px; border-radius: 99px; background: var(--brand); color: var(--brand-ink, #14101c); font: 700 var(--fs-xs)/1.2 var(--font-body); white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.35); max-width: 80vw; overflow: hidden; text-overflow: ellipsis; }
.kb-card.dragging { opacity: .3; }
.kb-board.touch-dragging .kb-col.over { box-shadow: 0 0 0 2px var(--c), 0 0 24px color-mix(in srgb, var(--c) 35%, transparent); }
.kb-board.touch-dragging .kb-drop { height: 6px; margin: 0; }

/* ---------------- telefone do sistema (botão flutuante com teclado) ---------------- */
[data-dial] { display: none !important; }
body.has-phone [data-dial] { display: inline-flex !important; }
.ph-fab { position: fixed; right: 24px; bottom: 24px; z-index: 900; width: 56px; height: 56px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--brand); color: var(--brand-ink, #14101c); box-shadow: 0 10px 28px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08); transition: transform .18s, bottom .25s, background .2s, width .2s; }
.ph-fab:hover { transform: translateY(-2px) scale(1.03); }
.ph-fab svg { width: 24px; height: 24px; }
.ph-fab .ph-dot { position: absolute; top: 6px; right: 6px; width: 12px; height: 12px; border: 2px solid var(--brand); }
.ph-fab.live { background: #16a34a; color: #fff; width: auto; min-width: 56px; padding: 0 18px 0 16px; border-radius: 28px; display: inline-flex; gap: 8px; align-items: center; }
.ph-fab.live svg { width: 20px; height: 20px; }
.ph-fab-time { font: 700 var(--fs-sm)/1 var(--font-body); font-variant-numeric: tabular-nums; }
.ph-fab-time:empty { display: none; }
.ph-fab.ringing { animation: ph-shake 1.2s infinite; }
@keyframes ph-shake { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } }
body.ph-raise .ph-fab { bottom: 96px; }
.ph-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; flex: none; }
.ph-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.ph-dot.connecting { background: var(--warn); }
.ph-dot.error { background: var(--danger); }
.ph-panel { position: fixed; right: 24px; bottom: 92px; z-index: 901; width: 320px; max-height: calc(100dvh - 120px); overflow: auto; border-radius: 22px; padding: 14px 16px 18px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 24px 60px rgba(0,0,0,.5); opacity: 0; transform: translateY(12px) scale(.98); transform-origin: bottom right; transition: opacity .18s, transform .18s; }
.ph-panel.show { opacity: 1; transform: none; }
body.ph-raise .ph-panel { bottom: 164px; }
.ph-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ph-head strong { display: block; font: 700 var(--fs-base)/1.2 var(--font-display); }
.ph-head small { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.ph-link { background: none; border: 0; padding: 0; color: var(--brand); font: 600 var(--fs-xs) var(--font-body); cursor: pointer; text-decoration: none; }
.ph-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.ph-tabs button { border: 0; background: none; color: var(--text-2); padding: 7px; border-radius: 9px; font: 600 var(--fs-sm) var(--font-body); cursor: pointer; }
.ph-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.ph-display { position: relative; }
.ph-num { width: 100%; border: 0; background: none; color: var(--text); text-align: center; font: 600 1.7rem/1.3 var(--font-display); letter-spacing: .03em; padding: 6px 40px; outline: none; }
.ph-num::placeholder { font-size: 1rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.ph-bs { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; display: grid; }
.ph-bs svg { width: 22px; height: 22px; }
.ph-hint { min-height: 18px; text-align: center; color: var(--muted); font-size: var(--fs-xs); margin-bottom: 8px; }
.ph-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; justify-items: center; margin: 4px 0 14px; }
.ph-keys button { width: 66px; height: 66px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer; display: grid; place-content: center; gap: 0; transition: background .12s, transform .08s; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.ph-keys button:hover { background: var(--surface-3); }
.ph-keys button:active { transform: scale(.94); background: color-mix(in srgb, var(--brand) 30%, var(--surface-2)); }
.ph-keys b { font: 600 1.45rem/1.05 var(--font-display); }
.ph-keys small { font-size: 9px; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.ph-keys.dtmf { margin-top: 14px; }
.ph-row { display: flex; justify-content: center; align-items: center; gap: 18px; }
.ph-row.two { gap: 48px; margin-top: 18px; }
.ph-btn { border: 0; border-radius: 50%; width: 52px; height: 52px; display: grid; place-items: center; cursor: pointer; color: #fff; transition: transform .1s, filter .15s; }
.ph-btn svg { width: 24px; height: 24px; }
.ph-btn.big { width: 64px; height: 64px; }
.ph-btn.big svg { width: 28px; height: 28px; }
.ph-btn.green { background: #16a34a; }
.ph-btn.red { background: #dc2626; }
.ph-btn.ghost { background: var(--surface-2); color: var(--text-2); width: auto; height: 40px; border-radius: 99px; padding: 0 16px; font: 600 var(--fs-sm) var(--font-body); }
.ph-btn:disabled { opacity: .4; cursor: default; }
.ph-btn:not(:disabled):hover { filter: brightness(1.08); }
.ph-btn:not(:disabled):active { transform: scale(.94); }
.ph-btn.pulse { animation: ph-pulse 1.4s infinite; }
@keyframes ph-pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.55); } 70% { box-shadow: 0 0 0 16px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.ph-note { color: var(--muted); font-size: var(--fs-xs); text-align: center; margin: 10px 0 0; }
.ph-call { text-align: center; padding: 8px 0 4px; }
.ph-av { width: 72px; height: 72px; border-radius: 50%; margin: 6px auto 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--text); font: 700 1.7rem/1 var(--font-display); }
.ph-call.ringing .ph-av { animation: ph-pulse 1.4s infinite; }
.ph-call h3 { margin: 0; font: 700 var(--fs-lg)/1.2 var(--font-display); word-break: break-word; }
.ph-sub { margin: 2px 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.ph-state { margin: 8px 0 6px; color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.ph-time { color: var(--text-2); font-weight: 600; }
.ph-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 16px 0 18px; }
.ph-tools button { border: 0; background: none; color: var(--text-2); cursor: pointer; display: grid; justify-items: center; gap: 6px; font: 600 11px var(--font-body); padding: 0; }
.ph-tools button svg { width: 48px; height: 48px; padding: 13px; border-radius: 50%; background: var(--surface-2); color: var(--text); transition: background .12s; }
.ph-tools button.on svg { background: var(--text); color: var(--surface); }
.ph-tools button:disabled { opacity: .4; cursor: default; }
.ph-xfer { display: grid; gap: 6px; margin: 14px 0 16px; text-align: left; max-height: 220px; overflow: auto; }
.ph-xfer small { color: var(--muted); font-size: var(--fs-xs); }
.ph-xfer button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 9px 12px; cursor: pointer; font: 500 var(--fs-sm) var(--font-body); }
.ph-recents { display: grid; max-height: 380px; overflow: auto; margin: 0 -6px; }
.ph-rc { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; border: 0; background: none; color: var(--text); text-align: left; padding: 9px 6px; border-radius: 10px; cursor: pointer; font: inherit; }
.ph-rc:hover { background: var(--surface-2); }
.ph-rc-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }
.ph-rc-ic svg { width: 15px; height: 15px; }
.ph-rc-ic.in { color: var(--ok); } .ph-rc-ic.out { color: #60a5fa; }
.ph-rc.missed .ph-rc-ic { color: var(--danger); } .ph-rc.missed strong { color: var(--danger); }
.ph-rc-t { min-width: 0; display: grid; }
.ph-rc-t strong { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-rc-t small { color: var(--muted); font-size: var(--fs-xs); }
.ph-rc time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.ph-empty { color: var(--muted); text-align: center; padding: 30px 0; font-size: var(--fs-sm); }
@media (max-width: 760px) {
  .ph-fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 54px; height: 54px; }
  body.ph-raise .ph-fab { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .ph-panel, body.ph-raise .ph-panel { left: 0; right: 0; bottom: 0; width: auto; max-height: 92dvh; border-radius: 22px 22px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); transform-origin: bottom center; transform: translateY(30px); }
  .ph-panel.show, body.ph-raise .ph-panel.show { transform: none; }
  body:has(.ph-panel.show) .ph-fab:not(.live) { opacity: 0; pointer-events: none; }
  .ph-keys button { width: 72px; height: 72px; }
  /* tela baixa ou barra de navegação do Android: as teclas encolhem para o botão de ligar caber sempre */
  .ph-panel, body.ph-raise .ph-panel { max-height: calc(100dvh - 12px); padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
  .ph-keys { gap: min(10px, 1.2dvh) 14px; margin-bottom: min(14px, 1.6dvh); }
  .ph-keys button { width: clamp(52px, calc((100dvh - 380px) / 4.4), 72px); height: clamp(52px, calc((100dvh - 380px) / 4.4), 72px); }
}
:root[data-theme="light"] .ph-panel { box-shadow: 0 24px 60px rgba(30,6,58,.22); }
:root[data-theme="light"] .ph-fab { box-shadow: 0 10px 28px rgba(30,6,58,.28); }

/* página Telefonia */
.pbx-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pbx-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-sm); }
.pbx-chip small { color: var(--muted); }
.pbx-ext { display: grid; grid-template-columns: 74px 1fr 1fr 130px 40px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pbx-ext:last-child { border-bottom: 0; }
.pbx-ext .num { font: 700 var(--fs-lg)/1 var(--font-display); }
.pbx-ext .st { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-2); }
.pbx-ext .input { min-height: 40px; height: 40px; }
.pbx-ext-h { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; padding-bottom: 6px; }
.pbx-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; margin-top: 16px; }
.pbx-grid > .card { margin: 0; }
.pbx-calls td { vertical-align: middle; }
.pbx-dir { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); }
.pbx-dir svg { width: 14px; height: 14px; }
.pbx-dir.in { color: var(--ok); } .pbx-dir.out { color: #60a5fa; } .pbx-dir.missed { color: var(--danger); }
.pbx-calls audio { height: 32px; max-width: 220px; }
.pbx-install code { display: block; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); margin: 10px 0; word-break: break-all; }
@media (max-width: 760px) {
  .pbx-ext { grid-template-columns: 60px 1fr 40px; }
  .pbx-ext .pbx-user, .pbx-ext-h { display: none; }
  .pbx-ext .st { grid-column: 2; }
}
.pbx-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.pbx-filter button { border: 1px solid var(--border); background: transparent; color: var(--text-2); font: 600 var(--fs-xs)/1 var(--font-body); padding: 8px 14px; border-radius: 99px; cursor: pointer; }
.pbx-filter button[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink, #14101c); }
.pbx-grid .input { height: 46px; min-height: 46px; }
.pbx-grid .form-grid { align-items: start; }
.pbx-rec { align-items: flex-start; margin-top: 6px; }
.pbx-rec span { display: grid; gap: 2px; }
.pbx-rec small { font-size: var(--fs-xs); }
.ph-av svg { width: 30px; height: 30px; }
.ph-head > div { margin-right: auto; }
.ph-x { border: 0; background: var(--surface-2); color: var(--text-2); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.ph-x svg { width: 16px; height: 16px; }
.pbx-tabs { margin: 0 0 16px; position: relative; }
.pbx-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 700; margin-left: 4px; }
.pbx-lead { font-size: var(--fs-sm); margin: -4px 0 14px; max-width: 760px; }
.card-head .btn-sm { flex: none; }
.pbx-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.pbx-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface-2); display: grid; gap: 12px; align-content: start; }
.pbx-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pbx-card header strong { display: block; font: 700 var(--fs-base)/1.2 var(--font-display); }
.pbx-card header small { color: var(--muted); font-size: var(--fs-xs); }
.pbx-card-act { display: flex; gap: 6px; flex: none; }
.pbx-card audio { width: 100%; height: 36px; }
.pbx-members { display: flex; flex-wrap: wrap; gap: 6px; }
.pbx-mem { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-xs); }
.pbx-mem b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: var(--brand-ink, #14101c); font-size: 10px; }
.pbx-flow { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.pbx-warn { margin: 0; font-size: var(--fs-sm); color: var(--warn); }
.pbx-opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); }
.pbx-opts kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 7px; background: var(--surface); border: 1px solid var(--border-strong); font: 700 var(--fs-sm) var(--font-body); margin-right: 6px; }
.pbx-entry { margin-bottom: 16px; }
.pbx-inrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pbx-inrow .input { flex: 1 1 320px; max-width: 520px; height: 46px; }
.pbx-grid { margin-top: 0; }
.gp-list { display: grid; gap: 4px; max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; padding: 6px 10px; }
.gp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; }
.gp-row .check { margin: 0; }
.gp-pos { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: var(--brand-ink, #14101c); font-size: 11px; }
.gp-mv { display: flex; gap: 4px; }
.gp-mv button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.gp-mv button:disabled { opacity: .35; cursor: default; }
.ur-audio { display: grid; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.ur-player { display: grid; gap: 4px; }
.ur-player audio { width: 100%; height: 36px; }
.ur-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ur-btns .rec-on { background: #dc2626; color: #fff; border-color: #dc2626; }
.ur-opts { display: grid; gap: 8px; margin-bottom: 8px; }
.ur-opt { display: grid; grid-template-columns: 120px 18px 1fr 40px; gap: 8px; align-items: center; }
.ur-opt .input { height: 42px; min-height: 42px; }
.ur-arrow { color: var(--muted); text-align: center; }
@media (max-width: 560px) { .ur-opt { grid-template-columns: 100px 1fr 36px; } .ur-arrow { display: none; } }
body.has-phone .toast-zone { right: 92px; } @media (max-width: 760px) { body.has-phone .toast-zone { right: 16px; bottom: 84px; } }
.pbx-card header { flex-wrap: wrap; } .pbx-card header > div { flex: 1 1 160px; min-width: 0; }
/* rota de entrada */
.pbx-route { display: grid; gap: 16px; }
.pbx-route > .card { margin: 0; }
.pbx-route select.input, .pbx-route input.input { height: 44px; min-height: 44px; }
#pbx-inbound { max-width: 520px; }
.pbx-flowcard { margin-bottom: 16px; }
.pbx-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.pbx-steps li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; position: relative; padding-bottom: 16px; }
.pbx-steps li:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 32px; bottom: 2px; width: 2px; background: var(--border-strong); }
.pbx-steps li b { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border-strong); font-size: var(--fs-sm); }
.pbx-steps li.end b { background: var(--brand); color: var(--brand-ink, #14101c); border-color: var(--brand); }
.pbx-steps li.warn b { background: var(--warn); color: #14101c; }
.pbx-steps li div { display: grid; gap: 2px; padding-top: 6px; }
.pbx-steps strong { font-size: var(--fs-sm); }
.pbx-steps small { color: var(--text-2); font-size: var(--fs-xs); }
.pbx-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); user-select: none; }
.pbx-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.pbx-switch span { width: 40px; height: 22px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .15s; flex: none; }
.pbx-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.pbx-switch input:checked + span { background: var(--ok); }
.pbx-switch input:checked + span::after { transform: translateX(18px); }
.pbx-switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.pbx-hours[data-off] { opacity: .45; pointer-events: none; }
.pbx-week { display: grid; gap: 6px; margin-bottom: 16px; }
.pbx-day { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); }
.pbx-day .check { width: 110px; margin: 0; }
.pbx-iv { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); }
.pbx-iv .input { width: 112px; height: 38px !important; min-height: 38px !important; padding: 0 8px; }
.pbx-closed-l { display: none; color: var(--muted); font-size: var(--fs-sm); }
.pbx-day.closed .pbx-iv, .pbx-day.closed [data-iv2] { display: none; }
.pbx-day.closed .pbx-closed-l { display: inline; }
.pbx-hol { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pbx-hol .pbx-mem button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 2px; }
.pbx-hol .input { width: 90px; height: 36px !important; min-height: 36px !important; }
.pbx-dids { display: grid; gap: 8px; }
.pbx-did { display: grid; grid-template-columns: 180px 180px 1fr 40px; gap: 8px; align-items: center; }
.pbx-save { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; z-index: 5; }
.pbx-save .btn { box-shadow: 0 8px 24px rgba(0,0,0,.35); }
body.has-phone .pbx-save { padding-right: 76px; }
@media (max-width: 760px) {
  .pbx-did { grid-template-columns: 1fr 1fr 36px; }
  .pbx-did select { grid-column: 1 / 3; grid-row: 2; }
  .pbx-day .check { width: 100%; }
  .pbx-save { justify-content: stretch; } .pbx-save .btn { flex: 1; }
}
#pbx-closed { max-width: 520px; }
/* botão "Salvar rota de entrada" sempre visível, fixo no canto (ao lado do botão do telefone) */
.pbx-route { padding-bottom: 84px; }
.pbx-save { position: fixed; bottom: 24px; right: 24px; z-index: 850; padding: 0 !important; }
body.has-phone .pbx-save { right: 96px; padding: 0 !important; }
.pbx-save .btn { min-height: 52px; padding: 0 22px; border-radius: 99px; box-shadow: 0 10px 28px rgba(0,0,0,.4); }
@media (max-width: 760px) {
  .pbx-save, body.has-phone .pbx-save { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  body.has-phone .pbx-save { right: 84px; }
  .pbx-save .btn { width: 100%; }
}
/* "Salvar rota de entrada": fica parado no fim da página, alinhado à direita (não acompanha a rolagem) */
.pbx-route { padding-bottom: 0; }
.pbx-save, body.has-phone .pbx-save { position: static; display: flex; justify-content: flex-end; padding: 0 !important; left: auto; right: auto; bottom: auto; }
.pbx-save .btn { min-height: 46px; border-radius: var(--radius-sm, 10px); box-shadow: none; padding: 0 20px; }
@media (max-width: 760px) { .pbx-save, body.has-phone .pbx-save { justify-content: stretch; } .pbx-save .btn { width: 100%; } }
/* abas que rolam para os lados: só na horizontal (antes também mexiam para cima e para baixo) */
.b-tabs { overflow-y: hidden; overscroll-behavior-x: contain; touch-action: pan-x pan-y; }
.b-tabs button { margin-bottom: 0; }
/* abas no celular: uma linha só que desliza para os lados e não mexe em mais nada (nem a página para cima/baixo, nem "solta" na diagonal) */
@media (max-width: 760px) {
  .b-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; overscroll-behavior: contain; touch-action: pan-x; -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity; scroll-padding-inline: 16px; max-width: 100%; contain: paint;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .b-tabs.at-end { -webkit-mask-image: none; mask-image: none; }
  .b-tabs button { flex: 0 0 auto; scroll-snap-align: start; padding: 11px 14px; }
  .b-tabs button:last-child { margin-right: 20px; }
}
.ph-body { display: flex; flex-direction: column; }
.ph-body .ph-recents { flex: 1; max-height: none; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.ph-body .ph-recents { align-content: start; grid-auto-rows: max-content; }

/* ---------- conversas: responsável e setores */
.cv-filters { position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; padding: 10px 12px; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.cv-chip { position: relative; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border); background: transparent; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cv-chip small { font-size: 11px; opacity: .7; font-weight: 700; }
.cv-chip.on { background: var(--gradient); border-color: transparent; color: var(--brand-ink); }
.cv-chip i { position: absolute; top: 3px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.cv-chip:hover:not(.on) { border-color: var(--border-strong); color: var(--text); }
.tags .t-owner { background: rgba(34,197,94,.15); color: #bbf7d0; }
.tags .t-sector { background: rgba(250,204,21,.15); color: #fde68a; }
:root[data-theme="light"] .tags .t-owner { color: #15803d; }
:root[data-theme="light"] .tags .t-sector { color: #a16207; }
.pt-head small b { font-weight: 700; color: var(--text); }
@keyframes permFlash { from { background: rgba(207,161,80,.22); } to { background: transparent; } }
.perm-flash { animation: permFlash 1.1s ease-out; border-radius: 8px; }

/* ---------- contatos (agenda) */
.ag-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: var(--space-4); }
.ag-search { flex: 1 1 280px; max-width: 420px; }
.ag-chips { position: static; padding: 0; border: 0; background: none; flex: 0 1 auto; flex-wrap: wrap; }
.ag-chips .cv-chip { flex: 0 0 auto; }
.ag-table tbody tr { cursor: pointer; }
.ag-table tbody tr:hover { background: var(--surface-2, rgba(255,255,255,.03)); }
.ag-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ag-who > div { min-width: 0; }
.ag-who .avatar { flex: 0 0 auto; }
.ag-tag { display: inline-block; font-size: 10.5px; padding: 0 6px; margin-right: 4px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.ag-mail a { color: var(--text-2); word-break: break-all; }
.ag-act { white-space: nowrap; text-align: right; }
.ag-act .btn { padding-inline: 8px; }
.ag-more { display: flex; justify-content: center; margin-top: 12px; }
.ag-total { text-align: center; font-size: var(--fs-xs); margin-top: 8px; }
.ag-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tags .t-agenda { background: rgba(168,85,247,.16); color: #e9d5ff; }
.tags .t-wa { background: rgba(37,211,102,.15); color: #86efac; }
:root[data-theme="light"] .tags .t-agenda { color: #7e22ce; }
:root[data-theme="light"] .tags .t-wa { color: #15803d; }
@media (max-width: 760px) {
  .ag-search { max-width: none; }
  .ag-chips { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; width: 100%; scrollbar-width: none; overscroll-behavior-x: contain; }
  .ag-chips::-webkit-scrollbar { display: none; }
  .ag-act { text-align: left; }
}
@media (max-width: 760px) { .table td.ag-act { display: flex; justify-content: flex-start; gap: 8px; } .ag-act .btn { min-width: 44px; } }
.cmp-lock { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font-size: var(--fs-sm); text-align: center; }
.cmp-lock[hidden] { display: none; }
.ph-panel button, .ph-fab { -webkit-tap-highlight-color: transparent; }
/* enquanto o sistema não sabe quem entrou, o menu fica escondido (sem "piscar" os itens do administrador) */
body.adm-boot .sidebar .nav, body.adm-boot [data-me-role] { visibility: hidden; }
/* telefone: botão "Colar" no campo vazio + cursor dourado */
.ph-num { caret-color: var(--brand); }
.ph-paste { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 99px; padding: 5px 10px; font: 600 12px var(--font-body); cursor: pointer; }
.ph-paste svg { width: 14px; height: 14px; }
.ph-paste[hidden] { display: none; }

/* ---------- suporte do sistema (chamados para a DataForce) */
.fm-item[hidden] { display: none !important; }
.fm-item .count { margin-left: auto; }
.who-btn.has-dot .who-av { position: relative; }
.who-btn.has-dot .who-av::after { content: ''; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--bg-2); }
.sup-list { display: grid; gap: 10px; }
.sup-item { display: grid; gap: 6px; padding: 14px 16px; margin: 0; color: inherit; text-decoration: none !important; transition: border-color .15s, transform .15s; }
.sup-item:hover { border-color: var(--border-strong); }
.sup-item.unread { border-color: color-mix(in srgb, var(--brand) 60%, transparent); }
.sup-item-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.sup-item-top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-item-sub { display: flex; gap: 12px; color: var(--text-2); font-size: var(--fs-sm); min-width: 0; }
.sup-item-sub > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.sup-item-sub time { color: var(--muted); white-space: nowrap; }
.sup-empty p { margin: 4px 0; }
.sup-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sup-cat input { position: absolute; opacity: 0; pointer-events: none; }
.sup-cat span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--border); cursor: pointer; font-weight: 600; font-size: var(--fs-sm); }
.sup-cat input:checked + span { background: var(--gradient); color: var(--brand-ink); border-color: transparent; }
.sup-cat input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.sup-att { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 6px; }
.sup-att-info { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); }
.sup-thread { display: grid; gap: 12px; margin-bottom: 16px; }
.sup-msg { max-width: min(720px, 92%); padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.sup-msg.me { justify-self: end; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.sup-msg.them { justify-self: start; }
.sup-msg-h { display: flex; justify-content: space-between; gap: 14px; font-size: var(--fs-sm); margin-bottom: 6px; }
.sup-msg-h time { color: var(--muted); }
.sup-msg-b { white-space: normal; line-height: 1.5; overflow-wrap: anywhere; }
.sup-img img { display: block; max-width: 100%; max-height: 320px; margin-top: 8px; border-radius: 10px; border: 1px solid var(--border); }
.sup-reply { display: grid; gap: 10px; }
.sup-reply-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sup-table tbody tr { cursor: pointer; } .sup-table tr.sup-new td { background: color-mix(in srgb, var(--brand) 6%, transparent); } .sup-meta { padding: 10px 16px; } .sup-meta summary { cursor: pointer; color: var(--text-2); }
.tags .t-transfer { background: rgba(244,114,182,.16); color: #fbcfe8; }
:root[data-theme="light"] .tags .t-transfer { color: #be185d; }
.cmp-lock small { color: var(--muted); }
/* busca nas conversas (como no WhatsApp) */
.cv-sec { padding: 10px 16px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.cv-hit small mark, .pane-item small mark { background: color-mix(in srgb, var(--brand) 35%, transparent); color: var(--text); border-radius: 3px; padding: 0 1px; }
.cv-hit small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes msgFlash { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 70%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.msg-flash { animation: msgFlash 2.2s ease-out; border-radius: 12px; }

/* ================= E-mail integrado ================= */
.ml-pane { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); }
.ml-top { display: grid; gap: 8px; padding: 10px 12px 8px; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.ml-acc { min-height: 38px; padding-top: 6px; padding-bottom: 6px; font-size: var(--fs-sm); }
.ml-folders { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 -2px; }
.ml-folders::-webkit-scrollbar { display: none; }
.ml-fd { flex: none; border: 0; background: transparent; color: var(--text-2); font: 600 12.5px var(--font-body); padding: 5px 9px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.ml-fd:hover { background: var(--surface); color: var(--text); }
.ml-fd.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand); }
#ml-filters { top: 0; }
.ml-item { align-items: flex-start; }
.ml-item .pi-main { gap: 1px; }
.ml-subj { font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-item.unread .pi-main strong, .ml-item.unread .ml-subj { color: var(--text); font-weight: 800; }
.ml-item.unread .ml-subj { font-weight: 700; }
.ml-n { font-size: 11px; font-weight: 700; color: var(--muted); }
.ml-ic { font-size: 12px; letter-spacing: 2px; min-height: 14px; }
.avatar.ml-av { background: rgba(96,165,250,.13); border-color: rgba(96,165,250,.35); color: #bfdbfe; }
.avatar.ml-av.sm { width: 32px; height: 32px; font-size: 12px; }
:root[data-theme="light"] .avatar.ml-av { color: #1d4ed8; }
.ml-msgs { gap: 12px; background: var(--bg); }
.ml-msg { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; flex: none; }
.ml-msg.out { border-color: rgba(207,161,80,.32); }
.ml-mh { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.ml-mh > div { flex: 1; min-width: 0; display: grid; }
.ml-mh b { font-size: var(--fs-sm); }
.ml-mh small { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-mh time { font-size: 11.5px; color: var(--muted); flex: none; }
.ml-msg .ml-snip { display: none; }
.ml-msg.collapsed .ml-snip { display: block; }
.ml-msg.collapsed .ml-to, .ml-msg.collapsed .ml-body { display: none; }
.ml-body { padding: 0 12px 12px; }
.ml-frame { display: block; width: 100%; height: 80px; border: 0; border-radius: 10px; background: #fff; }
.ml-imgbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); margin-bottom: 8px; padding: 6px 10px; background: var(--surface-2); border-radius: 8px; }
.ml-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ml-att { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); text-decoration: none !important; }
.ml-att:hover { border-color: var(--border-strong); }
.ml-att > span:first-child { font-size: 20px; }
.ml-att > span:last-child { display: grid; min-width: 0; }
.ml-att b { font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-att small { font-size: 11px; color: var(--muted); }
.ml-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); }
.ml-foot .btn { gap: 6px; }
.ml-lock { flex: 1; margin: 0; }
.ml-empty-card { text-align: center; padding: 40px 24px; max-width: 620px; margin: 20px auto; }
.ml-empty-card .ml-empty-ico { font-size: 44px; margin-bottom: 8px; }
.ml-empty-card p { margin: 10px auto 18px; max-width: 480px; }
@media (max-width: 960px) {
  .ml-pane { grid-template-columns: 1fr; }
  .ml-foot { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .ml-foot .btn { flex: 1; justify-content: center; }
  .ml-body { padding: 0 8px 10px; }
  .ml-msgs { padding: 10px 8px; }
  .page-head .hide-sm { display: none; }
}
/* escrever */
dialog.ml-compose { width: min(860px, calc(100vw - 24px)); max-width: none; }
dialog.ml-compose .modal-body { display: flex; flex-direction: column; gap: 0; padding: 0; max-height: calc(100dvh - 40px); }
.mc-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.mc-head h2 { margin: 0; font-size: var(--fs-lg, 1.15rem); }
.mc-x { width: 36px; height: 36px; border: 0; background: transparent; color: var(--text-2); font-size: 24px; border-radius: 50%; cursor: pointer; }
.mc-x:hover { background: var(--surface-2); }
.mc-row { position: relative; display: flex; align-items: center; gap: 10px; padding: 4px 18px; border-bottom: 1px solid var(--border); min-height: 46px; }
.mc-row > label { width: 64px; flex: none; font-size: var(--fs-sm); color: var(--muted); }
.mc-row select.input, .mc-row .mc-subj { flex: 1; border: 0; background: transparent; box-shadow: none; padding-left: 0; }
.mc-from { font-size: var(--fs-sm); color: var(--text-2); }
.mc-chips { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; cursor: text; }
.mc-chips input { flex: 1; min-width: 140px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-sm); padding: 6px 0; }
.mc-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-xs); }
.mc-chip.bad { border-color: rgba(239,68,68,.6); color: #fca5a5; }
.mc-chip button { width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
.mc-chip button:hover { background: var(--surface-3); color: var(--text); }
.mc-link { border: 0; background: transparent; color: var(--brand); font: 600 var(--fs-xs) var(--font-body); cursor: pointer; flex: none; }
.mc-sug { position: absolute; left: 80px; right: 18px; top: calc(100% - 2px); z-index: 20; display: grid; padding: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; }
.mc-sug button { display: grid; text-align: left; gap: 1px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.mc-sug button small { color: var(--muted); font-size: 11.5px; }
.mc-sug button.on, .mc-sug button:hover { background: var(--surface-2); }
.mc-tools, .sg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.mc-tools button, .sg-tools button, .sg-color { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font: 600 12.5px var(--font-body); cursor: pointer; }
.mc-tools button:hover, .sg-tools button:hover, .sg-color:hover { background: var(--surface-2); color: var(--text); }
.mc-sp { flex: 1; }
.sg-color { position: relative; }
.sg-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sg-ph { width: auto; min-height: 32px; padding: 4px 28px 4px 8px; font-size: 12.5px; }
.mc-editor { flex: 1; min-height: 240px; max-height: 52dvh; overflow-y: auto; padding: 14px 18px; background: #fff; color: #222; font: 14px/1.55 Arial, Helvetica, sans-serif; outline: 0; }
.mc-editor a { color: #1a5fd0; }
.mc-editor blockquote { margin: 0 0 0 .8ex; border-left: 2px solid #ccc; padding-left: 1ex; color: #555; }
.mc-editor img { max-width: 100%; }
.mc-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px; }
.mc-atts:not(:empty) { padding: 10px 18px 0; }
.mc-att { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); font-size: var(--fs-xs); max-width: 300px; }
.mc-att > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-att small { color: var(--muted); flex: none; }
.mc-att.err { border-color: rgba(239,68,68,.5); }
.mc-att button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.mc-actions { padding: 12px 18px 16px; margin: 0; align-items: center; }
.mc-actions .mc-hint { margin-right: auto; font-size: var(--fs-xs); }
dialog.ml-compose.drop-on .modal-body { outline: 2px dashed var(--brand); outline-offset: -6px; }
@media (max-width: 960px) {
  dialog.ml-compose { width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  dialog.ml-compose .modal-body { height: 100dvh; max-height: 100dvh; padding-top: env(safe-area-inset-top); }
  .mc-editor { max-height: none; min-height: 180px; }
  .mc-row { padding: 4px 12px; } .mc-row > label { width: 52px; }
  .mc-actions { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .mc-actions .mc-hint { width: 100%; }
  .mc-tools [data-cmd="removeFormat"], .mc-tools [data-cmd="insertOrderedList"] { display: none; }
}
/* caixas e assinatura */
.ml-backlink { font-size: var(--fs-sm); }
.ml-cfg-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.ml-cfg-head > div { flex: 1; min-width: 260px; }
.ml-boxes { display: grid; gap: 10px; margin-top: 16px; }
.ml-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); flex-wrap: wrap; }
.ml-box-main { flex: 1; min-width: 220px; display: grid; gap: 2px; }
.ml-box-main > small { color: var(--muted); font-size: var(--fs-xs); }
.ml-box-act { display: flex; gap: 6px; flex-wrap: wrap; }
.ml-st { font-size: var(--fs-xs); font-weight: 700; }
.ml-st.ok { color: #4ade80; } .ml-st.err { color: #f87171; } .ml-st.sync { color: #facc15; }
:root[data-theme="light"] .ml-st.ok { color: #15803d; } :root[data-theme="light"] .ml-st.err { color: #b91c1c; } :root[data-theme="light"] .ml-st.sync { color: #a16207; }
.ml-err { display: block; margin-top: 2px; }
.ml-tips { margin-top: var(--space-4); }
.ml-detect { font-size: var(--fs-sm); color: var(--text-2); margin: -4px 0 14px; padding: 8px 12px; border-radius: 9px; background: var(--surface-2); }
.ml-adv { margin: 4px 0 12px; }
.ml-adv summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 10px; }
.ml-srv { grid-template-columns: minmax(0, 2fr) minmax(70px, .7fr) minmax(0, 1fr); }
.ml-test { display: grid; gap: 4px; font-size: var(--fs-sm); padding: 10px 12px; border-radius: 9px; background: var(--surface-2); margin-bottom: 8px; }
.ml-test .err { color: #fca5a5; } .ml-test .ok { color: #86efac; }
:root[data-theme="light"] .ml-test .err { color: #b91c1c; } :root[data-theme="light"] .ml-test .ok { color: #15803d; }
.ml-sig-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
@media (max-width: 1100px) { .ml-sig-grid { grid-template-columns: 1fr; } .ml-srv { grid-template-columns: 1fr 1fr; } }
.sg-ed { min-height: 120px; padding: 12px 14px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 10px 10px; background: #fff; color: #333; outline: 0; font: 13px/1.45 Arial, Helvetica, sans-serif; }
.sg-tools { border: 1px solid var(--border); border-radius: 10px 10px 0 0; background: var(--surface-2); }
.sg-src { min-height: 160px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; border-top-left-radius: 0; border-top-right-radius: 0; }
.sg-preview { padding: 16px; border-radius: 10px; background: #fff; color: #333; border: 1px solid var(--border); overflow-x: auto; }
.ml-lead { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.ml-lead-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ml-lead-h h3 { margin: 0; font-size: var(--fs-base); }
.ml-lead-it { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 8px 10px; border-radius: 9px; color: var(--text); text-decoration: none !important; }
.ml-lead-it:hover { background: var(--surface-2); }
.ml-lead-it b { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-lead-it small { grid-column: 1; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-lead-it time { grid-row: 1; grid-column: 2; font-size: 11px; color: var(--muted); }
@media (min-width: 961px) {
  .ml-pane .pt-head { flex-wrap: wrap; row-gap: 10px; }
  .ml-pane .pt-head > div { flex: 1 1 calc(100% - 60px); }
  .ml-pane .pt-head .pt-actions { flex: 1 1 100%; }
  .ml-pane .pt-head > div strong { font-size: var(--fs-base); }
}
.sg-tools .sg-ph { width: auto; flex: 0 1 230px; min-width: 150px; }

/* ================= canais: WhatsApp (verde), Facebook (azul claro), Instagram (rosa) ================= */
:root { --ch-wa: #25D366; --ch-fb: #2D88FF; --ch-ig: #E1306C; --ch-li: #0A66C2; }
.cv-filters { flex-wrap: wrap; }
.cv-chips-row { display: flex; gap: 6px; width: 100%; }
.cv-chs { display: flex; gap: 4px; width: 100%; overflow-x: auto; scrollbar-width: none; }
.cv-chs::-webkit-scrollbar { display: none; }
.cv-ch { display: inline-flex; align-items: center; gap: 5px; flex: none; min-height: 28px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border); background: transparent; color: var(--text-2); font: 600 12px var(--font-body); cursor: pointer; }
.cv-ch svg { width: 14px; height: 14px; }
.cv-ch.ch-wa svg { color: var(--ch-wa); } .cv-ch.ch-fb svg { color: var(--ch-fb); } .cv-ch.ch-ig svg { color: var(--ch-ig); }
.cv-ch.on { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.cv-ch.on.ch-wa { border-color: var(--ch-wa); } .cv-ch.on.ch-fb { border-color: var(--ch-fb); } .cv-ch.on.ch-ig { border-color: var(--ch-ig); }
.tags .t-ch { color: #fff; }
.tags .t-ch.ch-wa { background: rgba(37,211,102,.18); color: #86efac; }
.tags .t-ch.ch-fb { background: rgba(45,136,255,.2); color: #a8ccff; }
.tags .t-ch.ch-ig { background: rgba(225,48,108,.2); color: #fbb6cf; }
:root[data-theme="light"] .tags .t-ch.ch-wa { color: #0f7a3a; }
:root[data-theme="light"] .tags .t-ch.ch-fb { color: #1259c3; }
:root[data-theme="light"] .tags .t-ch.ch-ig { color: #b0124d; }
.avatar { position: relative; }
.avatar.soc.ch-fb { background: rgba(45,136,255,.16); border-color: rgba(45,136,255,.45); color: #a8ccff; }
.avatar.soc.ch-ig { background: rgba(225,48,108,.15); border-color: rgba(225,48,108,.45); color: #fbb6cf; }
:root[data-theme="light"] .avatar.soc.ch-fb { color: #1259c3; } :root[data-theme="light"] .avatar.soc.ch-ig { color: #b0124d; }
.ch-dot { position: absolute; right: -3px; bottom: -3px; width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--bg-2); color: #fff; z-index: 2; }
.ch-dot svg { width: 10px; height: 10px; }
.ch-dot.ch-wa { background: var(--ch-wa); }
.ch-dot.ch-fb { background: var(--ch-fb); }
.ch-dot.ch-ig { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 95%); }
.pt-head .ch-dot { border-color: var(--surface); }
/* conectores na tela WhatsApp e redes */
.sc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sc-logos { display: flex; gap: 6px; }
.sc-logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.sc-logo svg { width: 20px; height: 20px; }
.sc-logo.ch-wa { background: var(--ch-wa); } .sc-logo.ch-fb { background: var(--ch-fb); }
.sc-logo.ch-ig { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 95%); }
.sc-logo.ch-li { background: var(--ch-li); }
.sc-pages { display: grid; gap: 10px; margin: 14px 0; }
.sc-page { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.sc-page > div { flex: 1; min-width: 220px; display: grid; gap: 4px; }
.sc-page small { color: var(--muted); font-size: var(--fs-xs); }
.sc-toggles { display: flex; gap: 14px; flex-wrap: wrap; }
.sc-toggles .check { margin: 0; font-size: var(--fs-sm); }
.sc-copy { display: flex; gap: 6px; align-items: center; }
.sc-copy code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 8px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border); font-size: 12.5px; }
.sc-steps { margin: 6px 0 0 18px; display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.sc-li { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-2); display: flex; gap: 10px; align-items: center; }
.avatar { overflow: visible; }
@media (max-width: 480px) {
  .cv-chs { gap: 3px; }
  .cv-ch { padding: 3px 7px; gap: 4px; font-size: 11px; }
  .cv-ch svg { width: 12px; height: 12px; }
}
.kb-wa-ic.ch-fb { color: var(--ch-fb); } .kb-wa-ic.ch-ig { color: var(--ch-ig); }
.kb-wa-ic.ch-fb svg, .kb-wa-ic.ch-ig svg { width: 14px; height: 14px; }
.b-tab-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--surface-3); color: var(--text); font-size: 11px; font-weight: 800; }
.b-tab-n.late { background: #dc2626; color: #fff; }
.b-remind { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(250,204,21,.35); background: rgba(250,204,21,.08); color: var(--text); font: 600 var(--fs-sm) var(--font-body); cursor: pointer; text-align: left; }
.b-remind.late { border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.1); }
.b-remind span { margin-left: auto; color: var(--brand); white-space: nowrap; }
@media (max-width: 600px) { .b-remind { flex-wrap: wrap; } .b-remind span { margin-left: 0; } }
.b-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-items: start; }
.b-team .b-todo h3 { align-items: center; flex-wrap: wrap; }
.b-team-n { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
.b-team-n .b-tab-n { margin: 0; width: auto; }
.b-todo-m { margin-bottom: 14px; }
.b-todo-m h3 { font-size: var(--fs-sm); margin: 0 0 4px; }
#b-todo .b-tab-n { margin-left: 2px; }
#b-todo small { margin-left: 2px; }
/* telefone: escolha do toque */
.ph-rings { display: grid; gap: 4px; padding: 10px 12px; }
.ph-ring { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.ph-ring:hover { background: var(--surface-2); }
.ph-ring.on { border-color: var(--brand); background: var(--surface-2); }
.ph-ring > span:last-child { display: grid; }
.ph-ring strong { font-size: var(--fs-sm); }
.ph-ring small { font-size: 11.5px; color: var(--muted); }
.ph-ring-ic { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); font-size: 11px; }
.ph-ring.on .ph-ring-ic { background: var(--brand); color: var(--brand-ink); }
.ph-vol { display: flex; align-items: center; gap: 10px; margin: 8px 2px 2px; font-size: var(--fs-sm); color: var(--text-2); }
.ph-vol input { flex: 1; accent-color: var(--brand); }
.ph-head > div { flex: 1; min-width: 0; }
.ph-x svg { width: 16px; height: 16px; }
.ph-bell.on { background: var(--brand); color: var(--brand-ink); }
.ph-rings { padding: 2px 2px 8px; overflow-y: auto; }
.ph-rings-h { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 4px; }
.ph-rings-h strong { font-size: var(--fs-sm); }
.ph-rings-g { display: block; margin: 10px 6px 2px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ph-vol { margin: 4px 6px 2px; }
.ph-vol span { font-size: 14px; }
.ph-body:has(.ph-rings) { overflow-y: auto; }
.sc-oauth { display: grid; gap: 8px; margin: 16px 0 6px; justify-items: start; }
.sc-fb-btn { background: #1877F2; color: #fff; border-color: #1877F2; gap: 10px; padding: 12px 20px; font-weight: 700; }
.sc-fb-btn:hover { background: #166fe5; color: #fff; }
.sc-fb-btn svg { width: 20px; height: 20px; }
.sc-manual { margin-top: 12px; }
.sc-manual > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }

/* ================= menu lateral recolhível (computador) ================= */
.nav-pin { display: none; }
@media (min-width: 961px) {
  .sidebar { position: sticky; }
  .nav-pin {
    display: grid; place-items: center; position: absolute; top: 18px; right: 12px; z-index: 2;
    width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  }
  .nav-pin:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
  .side-brand { padding-right: 34px; }
  html.nav-mini .app, html.nav-mini[data-theme="light"] .app { grid-template-columns: 76px 1fr; background: linear-gradient(to right, var(--bg-2) 76px, var(--bg) 76px); }
  html.nav-mini .sidebar { padding: var(--space-4) 10px; scrollbar-width: none; z-index: 35; }
  html.nav-mini .sidebar::-webkit-scrollbar { display: none; }
  html.nav-mini .side-brand { display: none; }
  html.nav-mini .nav-pin { position: static; margin: 2px auto 14px; width: 40px; height: 40px; }
  html.nav-mini .nav-pin .np-arrow { transform: rotate(180deg); transform-origin: 15px 12px; }
  html.nav-mini .nav a { position: relative; justify-content: center; padding: 11px 0; font-size: 0; gap: 0; }
  html.nav-mini .nav a svg { width: 20px; height: 20px; }
  html.nav-mini .nav a.active { box-shadow: inset 3px 0 0 var(--brand); }
  html.nav-mini .nav .count { position: absolute; top: 3px; right: 5px; min-width: 17px; padding: 0 4px; line-height: 17px; font-size: 10px; }
  html.nav-mini .nav a.locked .nav-lock { position: absolute; bottom: 4px; right: 8px; margin: 0; }
  html.nav-mini .nav a.locked .nav-lock svg { width: 11px; height: 11px; }
  html.nav-mini .who-btn { justify-content: center; padding: 8px 0; }
  html.nav-mini .who-btn .who, html.nav-mini .who-btn .who-chev { display: none; }
  html.nav-mini .foot-menu { position: fixed; left: 84px; right: auto; bottom: 16px; width: 240px; }
}
