:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --border: #e2e7ec;
  --text: #17212b;
  --muted: #5f6d7a;
  --primary: #2F80ED;
  --primary-ink: #ffffff;
  --primary-soft: #E8F1FD;
  --danger: #c0362c;
  --danger-soft: #fdecea;
  --warn: #a35c00;
  --warn-soft: #fff3df;
  --ok: #1d7a3a;
  --ok-soft: #e5f5ea;
  --info: #2457b8;
  --info-soft: #e8effc;
  --tim: #1f4fbf;
  --tim-soft: #e7eefc;
  --goto: #7a3fc4;
  --goto-soft: #f1eafb;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 4px 16px rgba(16, 24, 32, .06);
  --radius: 10px;
  --side-w: 220px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1418; --surface: #171e24; --surface-2: #1c242b; --border: #2a343d;
    --text: #e6ecf1; --muted: #93a1ad; --primary: #6EA8F5; --primary-ink: #071a33; --primary-soft: #15263d;
    --danger: #f0776d; --danger-soft: #3a1d1b; --warn: #f0b45c; --warn-soft: #3a2c14;
    --ok: #6fd08d; --ok-soft: #173222; --info: #8bb0ff; --info-soft: #1a2640;
    --tim: #8bb0ff; --tim-soft: #1a2640; --goto: #c6a2f5; --goto-soft: #2b2140;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1418; --surface: #171e24; --surface-2: #1c242b; --border: #2a343d;
  --text: #e6ecf1; --muted: #93a1ad; --primary: #6EA8F5; --primary-ink: #071a33; --primary-soft: #15263d;
  --danger: #f0776d; --danger-soft: #3a1d1b; --warn: #f0b45c; --warn-soft: #3a2c14;
  --ok: #6fd08d; --ok-soft: #173222; --info: #8bb0ff; --info-soft: #1a2640;
  --tim: #8bb0ff; --tim-soft: #1a2640; --goto: #c6a2f5; --goto-soft: #2b2140;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 15px; }
.brand-mark { width: 36px; height: 36px; flex: none; display: block; }
.brand-name { display: flex; flex-direction: column; line-height: 1.15; font-weight: 400; letter-spacing: -.01em; }
.brand-name b { font-weight: 800; }
.brand-name small { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .18em; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; padding: 8px; font-size: 12px; color: var(--muted); word-break: break-all; }
.side-foot button { margin-top: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center;
  padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.view { padding: 20px 24px 40px; max-width: 1280px; width: 100%; }
.bottom-nav { display: none; }
.top [data-sair] { display: none; }

/* ---------- Busca global ---------- */
.gsearch { position: relative; flex: 1; max-width: 560px; }
.gsearch input { padding-left: 34px; }
.gsearch > svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.gresults {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; overflow: auto; padding: 6px;
}
.gresults a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.gresults a:hover, .gresults a.sel { background: var(--surface-2); text-decoration: none; }
.gresults .gtag { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-right: 6px; }
.gresults .empty { padding: 10px; color: var(--muted); }

/* ---------- Controles ---------- */
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); border-color: var(--primary); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
input[readonly] { background: var(--surface-2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  padding: 8px 14px; min-height: 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.timeline .icon-btn { display: inline-block; vertical-align: middle; padding: 2px; }
.timeline .icon-btn svg { width: 14px; height: 14px; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.b-lead { background: var(--info-soft); color: var(--info); }
.b-cliente, .b-ganho, .b-ok { background: var(--ok-soft); color: var(--ok); }
.b-inativo, .b-arq { background: var(--surface-2); color: var(--muted); }
.b-perdido, .b-danger { background: var(--danger-soft); color: var(--danger); }
.b-warn, .b-negociacao { background: var(--warn-soft); color: var(--warn); }
.b-proposta, .b-qualificacao, .b-prospeccao { background: var(--primary-soft); color: var(--primary); }
.b-tim { background: var(--tim-soft); color: var(--tim); }
.b-goto { background: var(--goto-soft); color: var(--goto); }
.b-onvox { background: #fff1e6; color: #b45309; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .b-onvox { background: #3a2a14; color: #f5b46a; } }
:root[data-theme="dark"] .b-onvox { background: #3a2a14; color: #f5b46a; }

/* ---------- Página / listas ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar input[type="search"] { flex: 1 1 240px; max-width: 360px; }
.toolbar select { width: auto; flex: 0 1 auto; }
.toolbar label.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; user-select: none; white-space: nowrap; }
table.list th.sortable { cursor: pointer; }
table.list th.sortable:hover { color: var(--text); }
table.list th .arrow { opacity: .7; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--surface-2); }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tr.archived td { opacity: .55; }
table.list tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12px; }
.empty-state { padding: 40px 16px; text-align: center; color: var(--muted); }
.late { color: var(--danger); font-weight: 600; }
.soon { color: var(--warn); font-weight: 600; }

/* ---------- Ficha ---------- */
.ficha-head { padding: 18px 20px; margin-bottom: 16px; }
.ficha-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ficha-title h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 20px; margin-top: 16px; }
.fact .k { font-size: 12px; color: var(--muted); }
.fact .v { font-weight: 500; word-break: break-word; }
.obs { margin-top: 14px; white-space: pre-wrap; color: var(--text); background: var(--surface-2); padding: 10px 12px; border-radius: 8px; }
.ficha-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.panel { padding: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-body { padding: 8px 16px 14px; }
.item { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item.clickable { cursor: pointer; }
.links { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: 2px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 8.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.t-nota::before { background: var(--warn); }
.timeline li.t-tarefa_concluida::before { background: var(--ok); }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .what { white-space: pre-wrap; }
.note-form { display: flex; gap: 8px; margin: 6px 0 14px; }
.note-form textarea { min-height: 40px; }

/* ---------- Modal / formulários ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
}
dialog.modal.wide { width: min(940px, calc(100vw - 24px)); }
dialog.modal.narrow { width: min(420px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(10, 16, 22, .45); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); justify-content: flex-end; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; display: flex; gap: 8px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.grid .full { grid-column: 1 / -1; }
.fld label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.fld label .req { color: var(--danger); }
.fld .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.fld .help.warn { color: var(--warn); }
.fld .help.err { color: var(--danger); }
.fld.check { display: flex; align-items: center; gap: 8px; padding-top: 20px; }
.fld.check label { margin: 0; font-size: 14px; color: var(--text); font-weight: 500; }
.fld.invalid input, .fld.invalid select, .fld.invalid textarea { border-color: var(--danger); }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 700; margin: 18px 0 8px; display: flex; justify-content: space-between; align-items: center; }

.items-table { width: 100%; border-collapse: collapse; }
.items-table th { font-size: 12px; color: var(--muted); text-align: left; font-weight: 600; padding: 4px 6px; }
.items-table td { padding: 4px 6px; vertical-align: middle; }
.items-table td.sub { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.items-table input { min-height: 34px; padding: 6px 8px; }
.items-total { text-align: right; font-weight: 700; padding: 8px 6px 0; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(400px, 100%); padding: 26px 24px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card form { display: grid; gap: 12px; margin-top: 18px; }
.auth-links { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-top: 14px; flex-wrap: wrap; }
.notice { background: var(--info-soft); color: var(--info); padding: 8px 12px; border-radius: 8px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 1000; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; }
.toast.err { background: var(--danger); color: #fff; }

.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Celular ---------- */
@media (max-width: 860px) {
  .ficha-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top { padding: 8px 16px; }
  .top [data-sair] { display: inline-flex; }
  .view { padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; font-size: 11px; color: var(--muted); }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav svg { width: 20px; height: 20px; }
  .grid { grid-template-columns: 1fr; }
  .fld.check { padding-top: 0; }
  .toolbar input[type="search"] { max-width: none; flex-basis: 100%; }
  .toolbar select { flex: 1 1 40%; }
  .count { margin-left: 0; width: 100%; }

  /* tabela vira lista de cartões */
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td, table.list tfoot { display: block; width: 100%; }
  table.list tbody tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.list td { border: 0; padding: 2px 0; display: flex; gap: 8px; justify-content: space-between; text-align: right; }
  table.list td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  table.list td.primary-cell { display: block; text-align: left; padding-bottom: 4px; }
  table.list td.primary-cell::before { content: none; }
  table.list td:empty { display: none; }
  table.list td.num { justify-content: space-between; }
  table.list tfoot tr { display: flex; justify-content: space-between; padding: 10px 14px; }
  table.list tfoot td { width: auto; background: none; padding: 0; }
  table.list tfoot td::before { content: none; }
  .items-table thead { display: none; }
  .items-table tr { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .items-table td:first-child { grid-column: 1 / -1; }
  dialog.modal:not(.narrow) { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  dialog.modal:not(.narrow) form { max-height: 100dvh; height: 100%; }
  .modal-foot { padding: 10px 12px; gap: 6px; }
  .modal-foot .btn { padding: 6px 10px; }
  .modal-body { flex: 1; }
  .ficha-head { padding: 14px; }
}

/* =====================================================================
   Etapa 2: funil, Hoje, painel, importação, ajustes
   ===================================================================== */
.b-aberta { background: var(--primary-soft); color: var(--primary); }
.intro { margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 8px 14px; cursor: pointer; min-height: 38px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary-soft); color: var(--primary); }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.k-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 210px); min-height: 160px; transition: background .12s, border-color .12s; }
.k-col.over { background: var(--primary-soft); border-color: var(--primary); }
.k-head { padding: 10px 12px; border-bottom: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: var(--radius) var(--radius) 0 0; }
.k-ganho .k-head { border-top-color: var(--ok); }
.k-perdido .k-head { border-top-color: var(--danger); }
/* etapa com cor escolhida (Ajustes → Editar etapa) */
.k-col.k-cor { background: color-mix(in srgb, var(--etapa) 8%, var(--surface-2)); border-color: color-mix(in srgb, var(--etapa) 30%, var(--border)); }
.k-col.k-cor .k-head { border-top: 5px solid var(--etapa); background: color-mix(in srgb, var(--etapa) 16%, var(--surface)); }
.k-col.k-cor .k-card { border-left: 3px solid var(--etapa); }
.k-col.k-cor.over { background: color-mix(in srgb, var(--etapa) 20%, var(--surface-2)); border-color: var(--etapa); }
.b-cor { background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: color-mix(in srgb, var(--c) 75%, var(--text)); }
.cor-ponto { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.cor-barra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.cor-op { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; position: relative; }
.cor-op:hover { transform: scale(1.1); }
.cor-op.sel { box-shadow: 0 0 0 2px var(--text); }
.cor-op.sel::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; text-shadow: 0 0 2px rgba(0,0,0,.6); }
.cor-padrao { width: auto; border-radius: 99px; padding: 0 10px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.cor-padrao.sel::after { content: none; }
.cor-livre { display: grid; place-items: center; background: var(--c, var(--surface-2)); color: var(--muted); font-weight: 700; overflow: hidden; }
.cor-livre input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.k-list { padding: 8px; display: grid; gap: 8px; overflow-y: auto; align-content: start; flex: 1; }
.k-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 6px; border: 1px dashed var(--border); border-radius: 8px; }
.k-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); display: grid; gap: 3px; }
.k-card:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.k-card:focus-visible { outline: 2px solid var(--primary); }
.k-card.dragging { opacity: .4; }
.k-top { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; }
.k-top strong { font-size: 13px; line-height: 1.3; }
.k-sub { font-size: 12px; color: var(--muted); }
.k-val { display: flex; gap: 4px; align-items: baseline; }
.k-next { font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 5px; margin-top: 3px; }
.k-next.warn { color: var(--warn); font-weight: 600; }
.k-next.late { color: var(--danger); font-weight: 600; }
.k-move { display: none; margin-top: 6px; min-height: 32px; padding: 4px 8px; font-size: 13px; }
@media (hover: none), (pointer: coarse) { .k-move { display: block; } .k-card { cursor: pointer; } }

/* Hoje */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; color: var(--text); box-shadow: var(--shadow); }
a.tile:hover { text-decoration: none; border-color: var(--primary); }
.tile span { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile b { font-size: 22px; font-variant-numeric: tabular-nums; }
.tile small { font-size: 12px; color: var(--muted); }
.tile-danger b { color: var(--danger); }
.tile-warn b { color: var(--warn); }
.hoje-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.group-title { font-size: 13px; margin: 14px 0 2px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.group-title:first-child { margin-top: 6px; }
.item.task { align-items: center; }
.item.done { opacity: .45; text-decoration: line-through; }
.big-check { width: 22px; height: 22px; flex: none; cursor: pointer; }
.when-col { white-space: nowrap; text-align: right; }

/* Painel */
.month-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.metas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.meta-card { padding: 14px 16px; display: grid; gap: 6px; }
.meta-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.meta-pct { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meta-pct.ok { color: var(--ok); }
.meter { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.meta-nums { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
details summary { cursor: pointer; color: var(--primary); }
details div { padding: 2px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bar-row { padding: 6px 0; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 3px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--primary); border-radius: 99px; min-width: 2px; }
.bar-loss span { background: var(--danger); }
.meta-row { padding: 12px; margin-bottom: 10px; box-shadow: none; }
.meta-row > .btn { margin-top: 8px; }
.chk-row { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.chk-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); font-weight: 500; }

/* Importar */
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px; border: 2px dashed var(--border); border-radius: var(--radius); cursor: pointer; text-align: center; }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.drop svg { width: 28px; height: 28px; color: var(--primary); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.imp-table tbody tr { cursor: default; }

/* Ajustes / Mais */
.etapa-row { align-items: center; }
.etapa-row .ord { display: flex; flex-direction: column; width: 28px; }
.etapa-row .ord .icon-btn:disabled { opacity: .25; cursor: default; }
.mais-list a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--text); border-bottom: 1px solid var(--border); font-weight: 500; }
.mais-list a:last-child { border-bottom: 0; }
.mais-list a:hover { text-decoration: none; background: var(--surface-2); }
.mais-list svg { width: 20px; height: 20px; color: var(--muted); }
.mais-list svg:last-child { margin-left: auto; width: 16px; height: 16px; }

.side { overflow-y: auto; }

/* Google Agenda (Etapa 3) */
.ag-ico { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.ag-ico.pend { opacity: .6; }
.ag-ico.err { color: var(--danger); }
.ag-ev { align-items: baseline; }
.ag-ev .when-col { width: 64px; text-align: left; flex: none; }

/* Gmail (Etapa 4) */
.mail-item.unread .title { font-weight: 800; }
.mail-item .when-col { flex: none; }
.mail-msg { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
.mail-msg header { margin-bottom: 8px; }
.mail-frame { width: 100%; height: 340px; border: 0; background: #fff; border-radius: 6px; }
.mail-text { white-space: pre-wrap; font-size: 14px; }
.timeline li.t-email_enviado::before { background: var(--info); }
.ok-text { color: var(--ok); }

/* mapa da empresa */
.mapa { width: 100%; height: 280px; border: 0; border-radius: 8px; background: var(--surface-2); display: block; }
.mapa-head { flex-wrap: wrap; gap: 8px; }
.mapa-botoes { display: flex; gap: 6px; flex-wrap: nowrap; }

/* menu em grupos */
.nav-grupo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
.nav .nav-grupo:first-child { padding-top: 0; }
.view > .nav-grupo { padding: 16px 4px 6px; }
.nav a { padding-top: 7px; padding-bottom: 7px; }
.funil-ctl { display: inline-flex; align-items: center; gap: 2px; }

/* Etapa 6: funis, comissão, propostas */
.funil-sel { width: auto; min-width: 170px; font-weight: 600; }
.sel-row { background: var(--primary-soft); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.btn.primary-outline { border-color: var(--primary); color: var(--primary); }
.seg.tabs a { display: inline-flex; align-items: center; padding: 8px 14px; min-height: 38px; font-weight: 600; color: var(--muted); }
.seg.tabs a + a { border-left: 1px solid var(--border); }
.seg.tabs a.on { background: var(--primary-soft); color: var(--primary); }
.seg.tabs a:hover { text-decoration: none; }
.com-cli { margin-bottom: 14px; overflow: hidden; }
.com-head { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.com-total { font-size: 20px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.com-table td, .com-table th { padding: 8px 12px; }
.com-table tbody tr { cursor: default; }
.acoes-com { text-align: right; }
tr.row-warn td { background: var(--warn-soft); }
.tabela-com input { width: 90px; min-height: 32px; padding: 4px 8px; }
.tabela-com td:first-child { white-space: nowrap; font-weight: 600; }
.logo-prev { min-width: 120px; min-height: 48px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: 8px; padding: 6px; background: #fff; }
.logo-prev img { max-height: 60px; max-width: 200px; }

/* Documentos e WhatsApp */
.doc-item { align-items: center; }
.doc-ico { font-size: 22px; line-height: 1; flex: none; }
.timeline li.t-whatsapp::before { background: #25d366; }
.timeline li.t-documento::before { background: var(--muted); }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
@media (max-width: 1000px) {
  .hoje-grid, .stats-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .kanban { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 0 -16px; padding: 0 16px 12px; }
  .k-col { scroll-snap-align: start; max-height: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile b { font-size: 19px; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  .imp-table td.primary-cell { display: block; }
}

/* Prospecção LinkedIn */
.prosp-fila { display: grid; gap: 12px; }
.prosp-card { padding: 14px 16px; }
.prosp-card.prosp-off { opacity: .6; }
.prosp-head { display: flex; gap: 12px; align-items: flex-start; }
.prosp-head .grow { flex: 1; min-width: 0; }
.prosp-head .title { font-weight: 600; }
.prosp-card .notice { margin-top: 10px; }
.prosp-card textarea { width: 100%; margin-top: 10px; }
.prosp-acoes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.prosp-ferramentas { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.prosp-botao { flex-basis: 100%; padding: 10px 14px; }
.prosp-botao summary { cursor: pointer; }
.prosp-botao ol { margin: 10px 0; padding-left: 20px; display: grid; gap: 6px; }
.prosp-cads { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 12px; }
.prosp-passos { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.prosp-passo { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--surface-2); }
.prosp-passo-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.prosp-passo-top select { width: auto; }
.prosp-passo textarea { width: 100%; margin-top: 8px; }
@media (max-width: 720px) {
  .prosp-acoes .btn { flex: 1 1 auto; }
}

/* assistente de IA (barra embaixo das caixas de texto) */
.ia-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.ia-bar .btn.sm { padding: 3px 9px; font-size: 12px; }
.ia-tag { font-size: 11px; font-weight: 700; color: #9B51E0; margin-right: 2px; }
.ia-bar.ia-ocupada { opacity: .75; }
.ia-bar.ia-ocupada .ia-tag { animation: ia-pulsa 1s ease-in-out infinite; }
@keyframes ia-pulsa { 50% { opacity: .3; } }
.ia-ideia { flex-basis: 100%; display: flex; gap: 6px; margin-top: 4px; }
.ia-ideia input { flex: 1; min-width: 0; }

/* lembretes de tarefa (canto da tela) */
.lembretes { position: fixed; top: 12px; right: 12px; z-index: 60; display: grid; gap: 8px; width: min(380px, calc(100vw - 24px)); }
.lembrete { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-left: 4px solid var(--primary); box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: lembrete-entra .25s ease-out; }
.lembrete .grow { flex: 1; min-width: 0; }
.lembrete-acoes { display: flex; gap: 6px; flex-shrink: 0; }
@keyframes lembrete-entra { from { transform: translateY(-8px); opacity: 0; } }
@media (max-width: 760px) { .lembretes { top: calc(8px + env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; } }
.resumo-linha { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.resumo-linha select { width: auto; display: inline-block; margin-left: 4px; }

/* ficha: quadros com rolagem própria (e-mails e histórico não esticam a página) */
.rola { max-height: 460px; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.timeline.rola { margin-top: 10px; }
/* conversa do WhatsApp no histórico: já aberta, numa caixa com rolagem */
.conversa-box { margin-top: 6px; max-height: 210px; overflow-y: auto; overscroll-behavior: contain; background: var(--surface-2); border-radius: 8px;
  padding: 8px; display: grid; gap: 6px; font-size: 13px; }
.conversa-box .msg { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; max-width: 88%; justify-self: start; white-space: pre-wrap; }
.conversa-box .msg.eu { justify-self: end; background: color-mix(in srgb, #25d366 14%, var(--surface)); border-color: color-mix(in srgb, #25d366 30%, var(--border)); }
/* lista de e-mails */
.mail-item { padding: 9px 8px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 6px; min-width: 0; }
.mail-item:hover, .mail-item:focus-visible { background: var(--surface-2); outline: none; }
.mail-item:last-child { border-bottom: 0; }
.mail-l1 { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mail-de { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.mail-item.meu .mail-de { color: var(--muted); }
.mail-qtd { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 99px; padding: 0 6px; }
.mail-data { flex: none; font-size: 12px; color: var(--muted); }
.mail-assunto { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.mail-trecho { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item.unread .mail-de, .mail-item.unread .mail-assunto { font-weight: 800; }
.mail-item.unread .mail-data { color: var(--primary); font-weight: 700; }
.ficha-grid > *, .ficha-grid > * > *, .card.panel { min-width: 0; }

/* ---- Lista ou Cards (Empresas, Contatos) ---- */
.modo-vista { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-left: auto; }
.modo-vista .icon-btn { border-radius: 0; padding: 6px 8px; }
.modo-vista .icon-btn[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); }
.so-cards { display: none; width: auto; }
.modo-cards .so-cards { display: inline-block; }
.modo-cards .table-wrap { display: none; }
.cards-grid { display: none; }
.modo-cards .cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.kc { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; border-left: 3px solid transparent; transition: border-color .12s, box-shadow .12s; min-width: 0; }
.kc:hover, .kc:focus-visible { border-left-color: var(--primary); box-shadow: var(--shadow); outline: none; }
.kc.archived { opacity: .6; }
.kc-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kc-tit { flex: 1; min-width: 0; }
.kc-nome { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1em; }
.kc-info { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.kc-info > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.kc-valor { font-size: 14px; display: flex; gap: 4px; align-items: baseline; flex-wrap: wrap; }
.kc-pe { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); min-width: 0; }
.kc-contato { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; letter-spacing: .3px;
  color: hsl(var(--h) 55% 32%); background: hsl(var(--h) 70% 90%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { color: hsl(var(--h) 70% 85%); background: hsl(var(--h) 35% 26%); } }
:root[data-theme="dark"] .avatar { color: hsl(var(--h) 70% 85%); background: hsl(var(--h) 35% 26%); }

/* ícones de atendimento (cards e funil) */
.atd-row { display: flex; gap: 4px; flex: none; }
.atd { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 0; padding: 0; background: var(--surface-2); color: var(--muted); }
.atd svg { width: 15px; height: 15px; }
button.atd { cursor: pointer; }
button.atd:hover { transform: scale(1.08); }
.atd-tel { color: #2F80ED; background: color-mix(in srgb, #2F80ED 14%, var(--surface)); }
.atd-wa { color: #1fa855; background: color-mix(in srgb, #25d366 16%, var(--surface)); }
.atd-email { color: #d9822b; background: color-mix(in srgb, #f2994a 16%, var(--surface)); }
.atd-insta { color: #d62976; background: color-mix(in srgb, #d62976 14%, var(--surface)); }
.atd-off { opacity: .35; }
.k-card .atd-row { margin-top: 4px; }
.k-card .atd { width: 24px; height: 24px; } .k-card .atd svg { width: 13px; height: 13px; }

/* ---- Atendimento da tarefa ---- */
dialog.modal.atend { width: min(860px, calc(100vw - 24px)); }
.atend-tit { min-width: 0; } .atend-tit h2 { margin: 0 0 2px; font-size: 18px; }
.atend-ctx { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: flex-start; }
.atend-contato { display: flex; flex-direction: column; gap: 4px; }
.atend-contato select { width: auto; max-width: 260px; }
.atend-box { margin-top: 14px; padding: 0; overflow: hidden; }
.atend-canais { display: grid; grid-template-columns: repeat(6, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.atend-canais button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 11px 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px; border-bottom: 2px solid transparent; }
.atend-canais button svg { width: 16px; height: 16px; flex: none; }
.atend-canais button:hover { color: var(--text); }
.atend-canais button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); background: var(--surface); }
.atend-acao { padding: 10px 12px 0; min-height: 20px; }
.atend-acao .btn svg { width: 15px; height: 15px; vertical-align: -3px; }
.atend-box textarea { display: block; width: calc(100% - 24px); margin: 10px 12px 0; }
.atend-box .ia-bar { margin: 4px 12px 0; }
.atend-opcoes { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 12px; }
.atend-retorno { padding: 0 12px 12px; }
.atend-prazos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.atend-hist { margin-top: 16px; }
.atend-hist .timeline.rola { max-height: 300px; }
@media (max-width: 760px) {
  .atend-canais { grid-template-columns: repeat(3, 1fr); }
  .atend-canais button { padding: 9px 4px; font-size: 12px; }
}
/* histórico: atendimentos registrados pela tarefa */
.timeline li.c-ligacao::before { background: #2F80ED; }
.timeline li.c-email::before { background: #f2994a; }
.timeline li.c-whatsapp::before { background: #25d366; }
.timeline li.c-proposta::before { background: #9B51E0; }
.timeline li.c-reuniao::before { background: #00A3A3; }
.timeline li.c-visita::before { background: #EB5757; }

/* ---- Painel (dashboard) ---- */
/* cores dos gráficos (paleta validada para daltonismo, claro e escuro) */
.dash {
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --coutras: #a3a7ac; --c-perda: #e34948;
  --o1: #86b6ef; --o2: #5598e7; --o3: #2a78d6; --o4: #1c5cab; --o5: #104281;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .dash {
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --coutras: #5d646b; --c-perda: #e66767;
    --o1: #9ec5f4; --o2: #6da7ec; --o3: #3987e5; --o4: #256abf; --o5: #184f95;
  }
}
:root[data-theme="dark"] .dash {
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --coutras: #5d646b; --c-perda: #e66767;
  --o1: #9ec5f4; --o2: #6da7ec; --o3: #3987e5; --o4: #256abf; --o5: #184f95;
}
.page-head .actions select { width: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 4px; box-shadow: var(--shadow); align-content: start; }
.kpi > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.kpi > b { font-size: 26px; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi small { font-size: 12px; color: var(--muted); }
.delta { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.delta.up { color: var(--ok); background: var(--ok-soft); } .delta.down { color: var(--danger); background: var(--danger-soft); }
.kpi-meter { height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.kpi-meter span { display: block; height: 100%; background: var(--c1); border-radius: 99px; }
.dash-tit { font-size: 15px; margin: 0 0 10px; }
.meta-anel { display: flex; gap: 14px; align-items: center; }
.meta-info { display: grid; gap: 3px; min-width: 0; flex: 1; }
.anel { width: 76px; height: 76px; flex: none; }
.anel-trilho { fill: none; stroke: var(--surface-2); stroke-width: 9; }
.anel-valor { fill: none; stroke: var(--c1); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.anel.ok .anel-valor { stroke: var(--ok); }
.anel text { font-size: 16px; font-weight: 800; text-anchor: middle; fill: var(--text); font-variant-numeric: tabular-nums; }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.dash-largo { grid-column: span 2; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .dash-largo { grid-column: auto; } }
.dash-card .panel-body { padding-top: 6px; }
.dash-vazio { padding: 24px 0; text-align: center; }
/* pizza em anel */
.dn { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.dn svg { width: 150px; height: 150px; flex: none; }
.dn-trilho { fill: none; stroke: var(--surface-2); stroke-width: 16; }
.dn-arc { fill: none; stroke-width: 16; cursor: pointer; transition: stroke-width .12s; }
.dn-arc:hover { stroke-width: 19; }
.dn-centro { font-size: 13px; font-weight: 800; text-anchor: middle; fill: var(--text); font-variant-numeric: tabular-nums; }
.dn-sub { font-size: 9px; text-anchor: middle; fill: var(--muted); }
.dn-leg { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1; min-width: 170px; }
.dn-leg li { display: grid; grid-template-columns: 10px 1fr auto 38px; gap: 8px; align-items: center; font-size: 13px; cursor: default; }
.dn-leg li.zero { opacity: .5; }
.dn-leg i { width: 10px; height: 10px; border-radius: 3px; }
.dn-leg b { font-variant-numeric: tabular-nums; font-weight: 600; } .dn-leg .muted { text-align: right; font-size: 12px; }
.dn-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* barras horizontais */
.hb { display: grid; gap: 10px; }
.hb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; }
.hb-lab { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.hb-lab span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-trilho { height: 10px; background: var(--surface-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hb-trilho span { display: block; height: 100%; border-radius: 0 4px 4px 0; transition: width .5s ease; }
.hb-val { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.hb-row:hover .hb-trilho span { filter: brightness(1.08); }
/* colunas por mês */
.cols { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end; height: 210px; padding-top: 4px; border-bottom: 1px solid var(--border); }
.col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; cursor: default; min-width: 0; }
.col-val { font-size: 12px; font-weight: 700; min-height: 16px; font-variant-numeric: tabular-nums; }
.col-trilho { display: flex; align-items: flex-end; justify-content: center; }
.col-trilho span { width: min(46px, 70%); background: var(--o2); border-radius: 4px 4px 0 0; transition: height .5s ease; }
.col.atual .col-trilho span { background: var(--c1); }
.col:hover .col-trilho span { filter: brightness(1.1); }
.col-rot { font-size: 12px; color: var(--muted); padding: 6px 0 4px; text-transform: capitalize; }
.col.atual .col-rot { color: var(--text); font-weight: 700; }
/* balão de dica */
.dash-tip { position: fixed; z-index: 80; display: none; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 8px; padding: 6px 10px;
  font-size: 12px; box-shadow: var(--shadow); max-width: 260px; }
.dash-tip b { display: block; font-size: 12px; } .dash-tip span { opacity: .85; }

/* =====================================================================
   Visual 2026: inspirado no Kommo, com o azul da AC Planos.
   Menu lateral escuro, cantos mais redondos, sombras suaves e
   animações leves (respeitam "reduzir movimento" do sistema).
   ===================================================================== */
:root {
  --bg: #f2f5fa; --surface-2: #f6f8fc; --border: #e3e8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 35, 70, .05), 0 6px 20px rgba(15, 35, 70, .06);
  --shadow-hover: 0 4px 10px rgba(15, 35, 70, .08), 0 14px 32px rgba(15, 35, 70, .10);
  --side-bg: linear-gradient(180deg, #0f2747 0%, #0b1d36 100%);
  --side-text: #c9d6e8; --side-muted: #7f93ad; --side-hover: rgba(255, 255, 255, .07); --side-active: rgba(47, 128, 237, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --star: #f5b301; --star-off: #d9dee6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, .45), 0 14px 32px rgba(0, 0, 0, .35);
    --side-bg: linear-gradient(180deg, #0d1620 0%, #0a1118 100%);
    --star-off: #3a4651;
  }
}
:root[data-theme="dark"] {
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, .45), 0 14px 32px rgba(0, 0, 0, .35);
  --side-bg: linear-gradient(180deg, #0d1620 0%, #0a1118 100%);
  --star-off: #3a4651;
}

/* menu lateral escuro */
.side { background: var(--side-bg); border-right: 0; color: var(--side-text); padding: 18px 12px; }
.side .brand-name, .side .brand-name b { color: #fff; }
.side .brand-name small { color: var(--side-muted); }
.side .nav a { color: var(--side-text); border-radius: 10px; transition: background .15s var(--ease), color .15s, transform .15s var(--ease); }
.side .nav a:hover { background: var(--side-hover); color: #fff; transform: translateX(2px); }
.side .nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #5aa2ff; }
.side .nav a.active svg { color: #7db6ff; }
.side .nav-grupo { color: var(--side-muted); }
.side .side-foot { color: var(--side-muted); border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; }
.side .side-foot b { color: #fff; }
.side .side-foot .btn.ghost { color: var(--side-text); }
.side .side-foot .btn.ghost:hover { background: var(--side-hover); }
.side::-webkit-scrollbar { width: 6px; } .side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 9px; }

/* superfícies, botões e campos */
.card, .tile, .kpi, .k-col { border-radius: var(--radius); }
.btn { border-radius: 10px; transition: background .15s, box-shadow .15s, transform .08s var(--ease), filter .15s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #3b8bf0 0%, #2a74da 100%); border-color: #2a74da; box-shadow: 0 2px 6px rgba(47, 128, 237, .28); }
.btn.primary:hover { filter: brightness(1.05); box-shadow: 0 4px 12px rgba(47, 128, 237, .35); }
input, select, textarea { border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.badge { border-radius: 99px; }

/* cards que "levantam" ao passar o mouse */
.kc, .k-card, a.tile, .meta-card, .kpi, .dash-card, .item.clickable, .mail-item { transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s; }
.kc:hover, .k-card:hover, a.tile:hover, .meta-card:hover, .kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.k-card { border-radius: 10px; }
.k-col { background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); }

/* tela entrando suave */
@keyframes sobe { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view > * { animation: sobe .28s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: .03s; } .view > *:nth-child(3) { animation-delay: .06s; } .view > *:nth-child(4) { animation-delay: .09s; }
.kc, .kpi, .dash-card, .meta-card { animation: sobe .3s var(--ease) both; }
.cards-grid .kc:nth-child(2), .kpis .kpi:nth-child(2), .dash-grid > :nth-child(2) { animation-delay: .03s; }
.cards-grid .kc:nth-child(3), .kpis .kpi:nth-child(3), .dash-grid > :nth-child(3) { animation-delay: .06s; }
.cards-grid .kc:nth-child(n+4), .kpis .kpi:nth-child(n+4), .dash-grid > :nth-child(n+4) { animation-delay: .09s; }
/* janelas e avisos */
@keyframes surge { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
dialog.modal[open] { animation: surge .22s var(--ease); }
dialog.modal::backdrop { backdrop-filter: blur(2px); }
.toast { animation: surge .25s var(--ease); border-radius: 12px; }
/* tarefa concluída */
@keyframes feito { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
.item.done .title { text-decoration: line-through; opacity: .55; transition: opacity .3s; }
.big-check:checked, input[type="checkbox"]:checked { animation: feito .3s var(--ease); }

/* ⭐ estrelas de relacionamento */
.estrelas { display: inline-flex; gap: 1px; vertical-align: -2px; line-height: 1; cursor: help; }
.estrelas svg { width: 14px; height: 14px; }
.estrelas.sm svg { width: 12px; height: 12px; }
.estrelas.lg svg { width: 18px; height: 18px; }
.estrelas .on { fill: var(--star); } .estrelas .off { fill: var(--star-off); }
.estrelas-rot { font-size: 11px; font-weight: 700; color: var(--muted); margin-left: 4px; vertical-align: 1px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.kc-estrelas { margin-top: 3px; }
.ficha-estrelas { margin-top: 6px; }
.k-card .estrelas { margin: 1px 0; }

/* Automações (Ajustes) */
.auto-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 12px; transition: border-color .2s, box-shadow .2s; }
.auto-card.on { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent); }
.auto-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.auto-cfg { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.auto-cfg input[type="number"] { width: 64px; display: inline-block; margin: 0 4px; }
.auto-cfg select { width: auto; display: inline-block; margin-left: 4px; }
.auto-cfg .chk-row { display: flex; flex-wrap: wrap; gap: 6px 14px; flex-basis: 100%; }
.auto-pe { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.auto-lista { display: grid; gap: 12px; }
/* clientes esfriando (Hoje) */
.esf-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); transition: opacity .25s, transform .25s var(--ease); }
.esf-item:last-of-type { border-bottom: 0; }
.esf-item.saindo { opacity: 0; transform: translateX(16px); }
.esf-acoes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.atd-in { color: #0a66c2; background: color-mix(in srgb, #0a66c2 14%, var(--surface)); }
