/* 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; }
