/* Coopermiti CRM — visual
   Base clara e limpa, cartões brancos com sombra suave, verde-azulado da marca (#017975) como acento. */
:root {
  --bg: #f3f6f5;
  --panel: #ffffff;
  --ink: #12201e;
  --ink-2: #33433f;
  --muted: #74847f;
  --line: #e6ecea;
  --line-2: #eef2f1;
  --brand: #017975;
  --brand-600: #016a66;
  --brand-50: #e7f4f3;
  --brand-100: #cfe9e7;
  --lime: #8cc63f;
  --amber: #b26b00;  --amber-l: #fff4de;
  --red: #d64545;    --red-l: #fdecec;
  --blue: #2f6fd6;   --blue-l: #e9f1fd;
  --violet: #6d5bd0; --violet-l: #efecfd;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 36, .04), 0 6px 24px rgba(16, 40, 36, .06);
  --shadow-lg: 0 18px 50px rgba(16, 40, 36, .18);
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 14px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--red); min-height: 1em; margin: 0; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }

/* ---------- estrutura */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; }
.brand img { height: 34px; width: auto; }
.brand .crm { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--brand); background: var(--brand-50); padding: 4px 8px; border-radius: 999px; }
.nav-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; padding: 14px 12px 6px; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav a { color: var(--ink-2); padding: 10px 12px; border-radius: 12px; display: flex; align-items: center; gap: 12px; font-weight: 600; text-decoration: none; }
#nav a:hover { background: var(--line-2); }
#nav a.active { background: var(--brand-50); color: var(--brand); }
#nav a.active svg.i { stroke: var(--brand); }
#nav .badge { margin-left: auto; background: var(--red); color: #fff; }
.me { margin-top: 14px; border-top: 1px solid var(--line); padding: 14px 6px 0; display: flex; align-items: center; gap: 10px; }
.me .who { flex: 1; min-width: 0; }
.me .who a { color: var(--ink); font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.me .who span { color: var(--muted); font-size: 12px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); position: relative; padding: 0; }
.icon-btn:hover { border-color: #cfd8d6; }
.icon-btn .dot { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(243, 246, 245, .86); backdrop-filter: blur(10px); display: flex; align-items: center; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; height: 42px; color: var(--muted); }
.search input { border: 0; outline: 0; padding: 0; background: transparent; height: 40px; }
.topbar .spacer { flex: 1; }
.view { padding: 28px 32px 64px; max-width: 1440px; width: 100%; min-width: 0; }

/* ---------- avatar */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* ---------- cabeçalho de página e cartões */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: 2fr 1fr; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; }
.kpi > span:first-child { color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.kpi b { display: block; font-size: 30px; margin: 10px 0 6px; letter-spacing: -.02em; font-weight: 700; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.kpi .kpi-ico { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.kpi .kpi-ico.amber { background: var(--amber-l); color: var(--amber); }
.kpi .kpi-ico.red { background: var(--red-l); color: var(--red); }
.kpi .kpi-ico.blue { background: var(--blue-l); color: var(--blue); }
.kpi .kpi-ico.violet { background: var(--violet-l); color: var(--violet); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 6px; }
.trend.up { background: #e3f6e8; color: #1e8a43; }
.trend.down { background: var(--red-l); color: var(--red); }
.trend.flat { background: var(--line-2); color: var(--muted); }

/* ---------- botões e formulários */
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 9px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #cbd5d3; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(1, 121, 117, .25); }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.link:hover { color: var(--ink); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; color: var(--ink); width: 100%; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-50); border-color: var(--brand); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters > * { width: auto; min-width: 160px; }
.filters input[type=search] { flex: 1; min-width: 240px; }

/* ---------- tabelas */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: 12px; font-weight: 700; color: var(--muted); background: #fafcfb; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f7fbfa; }
.table-wrap { overflow-x: auto; }

/* ---------- selos */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.b-green { background: #e3f6e8; color: #1e8a43; }
.b-amber { background: var(--amber-l); color: var(--amber); }
.b-red { background: var(--red-l); color: var(--red); }
.b-blue { background: var(--blue-l); color: var(--blue); }
.b-brand { background: var(--brand-50); color: var(--brand); }
.b-prio { background: linear-gradient(90deg, #ffe9c7, #ffe0d6); color: #a8460d; }

/* ---------- tarefas */
.task { display: flex; gap: 14px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--line-2); }
.task:last-child { border-bottom: 0; }
.task .ch { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.task .info { flex: 1; min-width: 0; }
.task .info b { display: block; }
.task.overdue .ch { background: var(--red-l); color: var(--red); }
.task.prio { background: linear-gradient(90deg, #fff8ec, transparent 70%); border-radius: 12px; }
.task.prio .ch { background: #ffe9c7; color: #a8460d; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- funil */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: #ebf0ef; border-radius: var(--radius); padding: 12px; min-height: 220px; }
.col.drop { outline: 2px dashed var(--brand); }
.col h3 { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 6px; }
.kcard { background: #fff; border-radius: 12px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.kcard:hover { border-color: var(--brand-100); }
.kcard b { display: block; margin-bottom: 3px; }
.kcard.late { border-left: 3px solid var(--red); }

/* ---------- histórico */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 12px 20px; border-left: 2px solid var(--line); position: relative; margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--brand-100); }
.timeline li.etapa::before { background: var(--blue); }
.timeline li.sistema::before { background: #b9c6c3; }
.timeline pre { white-space: pre-wrap; font: inherit; background: #f6f9f8; padding: 10px 12px; border-radius: 10px; margin: 6px 0 0; color: var(--ink-2); }
.journey { list-style: none; margin: 0; padding: 0; }
.jstep { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.jstep:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--line); }
.jnum { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--brand); color: #fff; }
.jstep.in .jnum { background: var(--blue); }
.jstep.next .jnum { background: #fff; color: #b37400; border: 2px dashed #f0a422; }
.jbody { flex: 1; min-width: 0; background: #f6f9f8; border-radius: 12px; padding: 10px 12px; display: grid; gap: 3px; }
.jstep.next .jbody { background: var(--amber-l); }
.jbody .row { gap: 6px; flex-wrap: wrap; }
.jbody .i { vertical-align: -3px; }
.jnote { white-space: pre-wrap; border-left: 3px solid var(--line); padding-left: 8px; margin: 2px 0; }
.steps { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0; }
.steps span { flex: 1; min-width: 18px; height: 6px; border-radius: 3px; background: var(--line); }
.steps span.done { background: var(--brand); }
.steps span.now { background: #f0a422; }

/* ---------- janelas e avisos */
.modal { position: fixed; inset: 0; background: rgba(12, 28, 25, .45); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { background: #fff; border-radius: 20px; width: min(780px, 100%); max-height: 92vh; overflow: auto; padding: 26px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.script { background: #f6f9f8; border: 1px solid var(--line); border-radius: 12px; padding: 14px; white-space: pre-wrap; line-height: 1.55; }
.hint { background: var(--amber-l); color: #6b4200; border-radius: 12px; padding: 10px 14px; font-size: 13px; margin: 10px 0; }
.ok-box { background: #e3f6e8; color: #1b6e38; border-radius: 12px; padding: 10px 14px; font-size: 13px; margin: 10px 0; }
.effect { background: var(--blue-l); color: #1f4470; border-radius: 12px; padding: 10px 14px; font-size: 13px; line-height: 1.45; }
.ai-box { border: 1px solid var(--brand-100); background: linear-gradient(180deg, #f1faf9, #fff); border-radius: 14px; padding: 12px 14px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; max-width: 380px; }
.toast { background: #13231f; color: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-lg); animation: pop .25s ease-out; }
.toast.alert { background: #fff; color: var(--ink); border-left: 5px solid #f0a422; }
.toast .row { margin-top: 10px; }
.toast.alert { position: relative; padding-right: 36px; }
.toast-x { position: absolute; top: 8px; right: 8px; border: 0; background: none; color: var(--ink-2); font-size: 14px; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.toast-x:hover { background: #eef3f2; color: var(--ink); }
@keyframes pop { from { transform: translateY(12px); opacity: 0; } }
body:has(#modal:not([hidden])) .toast.alert { display: none; }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 600px at 10% -10%, #cfe9e7 0%, transparent 60%),
  radial-gradient(900px 500px at 110% 110%, #e0f0d0 0%, transparent 55%), var(--bg); }
.login-card { background: #fff; border-radius: 24px; padding: 36px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.login-card .brand { justify-content: center; padding-bottom: 6px; }
.login-card .brand img { height: 52px; }
.login-card .sub { text-align: center; color: var(--muted); margin-top: -8px; }

/* ---------- playbook, chips */
.playbook h2 { margin-top: 26px; }
.playbook li { margin-bottom: 6px; line-height: 1.55; }
.playbook p { line-height: 1.65; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.chip:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- caixa de entrada */
.thread-row { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.thread-row:last-child { border-bottom: 0; }
.thread-row:hover { background: #f8fbfa; }
.thread-row.unread { background: #f4faf9; }
.thread-row.unread b { color: var(--brand); }
.thread-row.prio { background: linear-gradient(90deg, #fff6e6, #fffdf8 60%); box-shadow: inset 4px 0 0 #f0a422; }
.tr-main { flex: 1; min-width: 0; }
.tr-side { text-align: right; min-width: 140px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.in { border-left: 4px solid var(--blue); }
.msg.out { border-left: 4px solid var(--brand); background: #fbfefd; }
.msg-body { white-space: pre-wrap; line-height: 1.55; margin-top: 8px; overflow-wrap: anywhere; }
details summary { cursor: pointer; margin-top: 6px; }
.sug { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: #fcfdfd; }
.cep-card { border-left: 4px solid var(--brand); }

/* ---------- painel do gestor */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.member { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fcfdfd; }
.member .top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.member .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.member .stat { background: var(--line-2); border-radius: 10px; padding: 8px; text-align: center; }
.member .stat b { display: block; font-size: 18px; }
.member .stat span { font-size: 11px; color: var(--muted); }
.member .last { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.bar { height: 10px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #3aa79f); border-radius: 999px; }
.funnel-row { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; margin: 9px 0; font-size: 13px; }
.chart-box { position: relative; height: 260px; }
.feed-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.feed-item:last-child { border-bottom: 0; }

@media (max-width: 1100px) { .cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .cols-2, .cols-3, .cols-4, .form-grid { grid-template-columns: 1fr; }
  .view, .topbar { padding-left: 16px; padding-right: 16px; }
}

/* ajustes: itens de grade podem encolher (tabelas rolam por dentro), busca em linha, título do KPI livre do ícone */
.grid > *, .kpis > * { min-width: 0; }
label.search { flex-direction: row; font-weight: 500; color: var(--muted); }
.kpi > span:first-child { display: block; padding-right: 46px; line-height: 1.35; }
.funnel-row { grid-template-columns: minmax(90px, 130px) minmax(60px, 1fr) 30px; }
@media (max-width: 1280px) { .cols-3 { grid-template-columns: 1fr; } }
.card { overflow-x: auto; }

/* =====================================================================
   Tema colorido (ref.: navegação escura em verde-azulado, destaques
   verde-água e limão do logo, coral/âmbar para urgência, azul e violeta
   para dados).
   ===================================================================== */
:root {
  --bg: #eef4f3;
  --nav-1: #0e5a56; --nav-2: #033f3c;
  --seafoam: #2dd4bf; --lime: #8cc63f;
  --coral: #ff7f52; --coral-l: #ffece4;
  --gold: #ffaa1d; --gold-l: #fff3db;
  --sky: #3b82f6; --sky-l: #e8f0fe;
  --grape: #8b5cf6; --grape-l: #f1ebfe;
  --red: #e5533d; --red-l: #fdebe7;
}

/* menu lateral colorido */
.sidebar { background: linear-gradient(180deg, var(--nav-1) 0%, var(--nav-2) 100%); border-right: 0; color: #d7eeeb; box-shadow: 4px 0 24px rgba(3, 63, 60, .18); z-index: 30; }
.sidebar .brand { background: #fff; border-radius: 18px; padding: 14px 12px; margin: 0 2px 18px; justify-content: center; box-shadow: 0 8px 22px rgba(0, 0, 0, .14); }
.sidebar .brand img { height: 64px; }
.sidebar .brand:hover { text-decoration: none; }
.nav-label { color: rgba(255, 255, 255, .45); }
#nav a { color: rgba(255, 255, 255, .80); position: relative; }
#nav a svg.i { stroke: #7fe3d3; }
#nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
#nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
#nav a.active svg.i { stroke: #fff; }
#nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--lime); }
#nav .badge { background: var(--coral); color: #fff; }
.me { border-top-color: rgba(255, 255, 255, .12); }
.me .who a { color: #fff; }
.me .who span { color: rgba(255, 255, 255, .6); }
.me .icon-btn { background: transparent; border-color: rgba(255, 255, 255, .25); color: #fff; }
.me .icon-btn:hover { background: rgba(255, 255, 255, .1); }

/* menu escondido pelo botão de hambúrguer */
.shell { transition: grid-template-columns .2s ease; }
body.nav-hidden .shell { grid-template-columns: 0 1fr; }
body.nav-hidden .sidebar { visibility: hidden; padding: 0; overflow: hidden; }
#menuBtn { margin-right: 4px; }

/* barra superior */
.topbar { background: rgba(238, 244, 243, .9); }
.icon-btn .dot { background: var(--coral); }

/* botões */
.btn.primary { background: linear-gradient(135deg, #01918c, var(--brand)); border-color: var(--brand); }

/* cartões de número com cor própria (cada um um tom) */
.kpis > .kpi { --tint: var(--brand-50); --c: var(--brand); background: linear-gradient(140deg, #fff 52%, var(--tint) 100%); border-color: transparent; }
.kpis > .kpi:nth-child(6n+2) { --tint: var(--gold-l); --c: #c27c00; }
.kpis > .kpi:nth-child(6n+3) { --tint: var(--coral-l); --c: var(--coral); }
.kpis > .kpi:nth-child(6n+4) { --tint: var(--sky-l); --c: var(--sky); }
.kpis > .kpi:nth-child(6n+5) { --tint: var(--grape-l); --c: var(--grape); }
.kpis > .kpi:nth-child(6n+6) { --tint: #eaf6dc; --c: #5f9a1f; }
.kpis > .kpi::after { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.kpi .kpi-ico, .kpi .kpi-ico.amber, .kpi .kpi-ico.red, .kpi .kpi-ico.blue, .kpi .kpi-ico.violet { background: #fff; color: var(--c); box-shadow: 0 4px 12px rgba(16, 40, 36, .08); }
.kpi b { color: #0c2421; }

/* faixa de boas-vindas do Painel */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 24px 26px; margin-bottom: 20px; color: #fff;
  background: radial-gradient(600px 220px at 100% 0%, rgba(140, 198, 63, .45), transparent 60%), linear-gradient(120deg, #0e5a56 0%, #017975 55%, #12a39b 100%);
  box-shadow: 0 14px 34px rgba(1, 121, 117, .25); }
.hero h1 { color: #fff; margin: 0; font-size: 26px; }
.hero p { margin: 6px 0 0; color: rgba(255, 255, 255, .85); }
.hero .hero-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.hero .hero-stats a { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); color: #fff; border-radius: 14px; padding: 10px 14px; text-decoration: none; min-width: 150px; }
.hero .hero-stats a:hover { background: rgba(255, 255, 255, .22); }
.hero .hero-stats b { display: block; font-size: 22px; }
.hero .hero-stats span { font-size: 12px; color: rgba(255, 255, 255, .85); }
.hero .btn { background: #fff; color: var(--brand); border-color: #fff; box-shadow: none; }

/* caixa de entrada enxuta */
.inbox-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.tabs { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { background: var(--line-2); }
.tabs a.on { background: var(--brand); color: #fff; }
.tabs a.tab-svc:not(.on) { color: #a8460d; }
.tabs .count { background: var(--coral); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.tabs a.on .count { background: rgba(255, 255, 255, .25); }
.search.sm { height: 36px; max-width: 220px; padding: 0 12px; }
.search.sm input { height: 34px; }
select.sm { width: auto; padding: 7px 10px; border-radius: 999px; }
.icon-btn.sm { width: 32px; height: 32px; font-weight: 700; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-size: 12.5px; color: var(--muted); }
.legend b { color: var(--ink); margin-right: 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: #b6c4c1; }
.dot.st-nova { background: var(--gold); }
.dot.st-aberta { background: var(--coral); }
.dot.st-aguardando { background: var(--sky); }
.dot.st-fechada { background: #2fa36b; }
.mlist { padding: 4px; }
.mrow { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; cursor: pointer; }
.mrow + .mrow { border-top: 1px solid var(--line-2); }
.mrow:hover { background: #f5faf9; }
.mrow .m-main { flex: 1; min-width: 0; }
.mrow .m-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mrow .m-who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .m-co { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .m-co::before { content: "· "; }
.mrow .m-subj { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.mrow .m-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.mrow .m-time { font-size: 12px; color: var(--muted); }
.mrow .m-status { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 2px; }
.mrow .m-status .avatar { margin-left: 8px; }
.mrow.unread .m-who { font-weight: 800; color: var(--ink); }
.mrow.unread .m-subj { color: var(--ink); font-weight: 600; }
.mrow.prio { background: linear-gradient(90deg, #fff4e3, #fffdf8 70%); box-shadow: inset 4px 0 0 var(--gold); }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }

@media (max-width: 900px) {
  body.nav-hidden .sidebar { display: none; }
}

/* linha da caixa de entrada: tudo alinhado à esquerda */
.mrow { align-items: center; }
.mrow > .avatar { margin-top: 2px; }
.mrow .m-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.mrow .m-meta > span { display: inline-flex; align-items: center; }
.mrow .m-meta .badge { font-size: 11px; }
.mrow .m-owner { gap: 6px; color: var(--ink-2); }
.unread-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex: none; margin-right: 8px; box-shadow: 0 0 0 3px rgba(1,121,117,.15); }
.btn.spinning .i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Atendimentos (histórico da planilha) */
.at-duv { display: flex; flex-direction: column; gap: 2px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.at-duv b { font-weight: 600; font-size: 13px; }
.at-row { padding: 12px 2px; border-top: 1px solid var(--line-2); }
.at-cat:hover span { color: var(--brand); }
.inbox-bar .search.sm { flex: 0 1 220px; min-width: 150px; }
.mrow .m-side { min-width: 150px; gap: 5px; }
.mrow .m-side .m-owner { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.mrow .m-side .m-owner.muted { color: var(--muted); }
@media (max-width: 700px) { .mrow .m-side { display: none; } }

/* Resposta: popup "Validar resposta" e trechos para ajustar */
.ed-tools { margin: 8px 0 6px; gap: 8px; }
.r-body { width: 100%; }
.marks-box { margin-top: 8px; background: #fff7e6; border: 1px solid #ffd99a; border-radius: 10px; padding: 8px 12px; color: #7a4a00; }
.marks-box ul { margin: 4px 0 0 18px; padding: 0; }
.marks-box li b { background: #ffe7b3; border-radius: 4px; padding: 0 3px; }
.client-msg { background: var(--line-2, #f3f6f5); border-radius: 12px; padding: 10px 14px; }
.client-msg .msg-body { max-height: 180px; overflow: auto; margin-top: 6px; white-space: pre-wrap; }
.marks-box li { margin: 6px 0; }
.sug-text { margin: 4px 0 6px; padding: 6px 10px; background: #fff; border-radius: 8px; color: var(--ink-2); font-style: italic; }
.funnel-row.click { cursor: pointer; border-radius: 8px; }
.funnel-row.click:hover span, .funnel-row.on span { color: var(--brand); font-weight: 600; }
tr.click { cursor: pointer; }

/* ---------- limpeza da caixa: seleção e ações em lote */
.selbar { display: flex; align-items: center; gap: 10px; padding: 6px 14px; margin-bottom: 8px; min-height: 44px; flex-wrap: wrap; }
.selbar .row { gap: 6px; flex-wrap: wrap; }
label.m-check { display: grid; flex-direction: row; place-items: center; width: 22px; height: 22px; flex: none; cursor: pointer; }
.m-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.mrow.picked { background: var(--brand-50, #eaf6f5); }
.clean-list { display: grid; gap: 6px; margin-top: 8px; max-height: 46vh; overflow-y: auto; overflow-x: hidden; }
label.clean-row { flex-direction: row; font-weight: 400; color: var(--ink); gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.clean-row:has(input:checked) { border-color: var(--brand); background: #f3faf9; }
.clean-row > div { min-width: 0; overflow-wrap: anywhere; }
.clean-row input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--brand); flex: none; }

/* ---------- marca CRMITI no menu */
.sidebar .brand { flex-direction: column; gap: 6px; }
.sidebar .brand .crm { font-size: 11px; }

/* ---------- WhatsApp: lista + conversa */
.wa-shell { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
.wa-list { padding: 12px; max-height: calc(100vh - 190px); overflow-y: auto; }
.wa-list .search { display: flex; }
.wa-item { display: flex; gap: 10px; padding: 10px; border-radius: 12px; color: inherit; text-decoration: none; align-items: flex-start; }
.wa-item + .wa-item { border-top: 1px solid var(--line-2); }
.wa-item:hover { background: #f5faf9; text-decoration: none; }
.wa-item.on { background: var(--brand-50); }
.wa-item .m-main { flex: 1; min-width: 0; }
.wa-item .m-top { display: flex; align-items: center; gap: 6px; }
.wa-item .m-who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item.unread .m-who { font-weight: 800; }
.wa-item .m-side { display: grid; justify-items: end; gap: 4px; font-size: 11.5px; color: var(--muted); text-align: right; }
.wa-item .m-owner { display: inline-flex; align-items: center; gap: 4px; }
.wa-snip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-conv { display: flex; flex-direction: column; gap: 10px; min-height: 420px; max-height: calc(100vh - 190px); padding: 14px; }
.wa-head { display: flex; align-items: center; gap: 10px; }
.wa-back { display: none; }
.wa-tools { gap: 8px; }
.wa-fields { background: var(--brand-50); border-radius: 12px; padding: 8px 12px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.wa-msgs { flex: 1; overflow-y: auto; background: #efeae2; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 200px; }
.wa-msg { max-width: 78%; padding: 7px 10px 5px; border-radius: 10px; font-size: 13.5px; line-height: 1.4; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); overflow-wrap: anywhere; }
.wa-msg.in { background: #fff; align-self: flex-start; border-top-left-radius: 2px; }
.wa-msg.out { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 2px; }
.wa-by { font-size: 11px; font-weight: 700; color: var(--brand); margin-bottom: 2px; }
.wa-meta { font-size: 10.5px; color: #667781; text-align: right; margin-top: 2px; }
.wa-sys { align-self: center; background: #fff8d6; color: #5c4d00; font-size: 12px; padding: 5px 10px; border-radius: 8px; text-align: center; max-width: 90%; }
.wa-reply { display: flex; gap: 8px; align-items: flex-end; }
.wa-reply textarea, .wa-reply input { flex: 1; }
.wa-phone { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.wa-phone .wa-msgs { height: 340px; flex: none; }
@media (max-width: 900px) {
  .wa-shell { grid-template-columns: 1fr; }
  .wa-shell.has-conv .wa-list { display: none; }
  .wa-shell:not(.has-conv) .wa-conv { display: none; }
  .wa-back { display: inline-flex; }
}

/* ---------- mapa de atendimento */
.flow-shell { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.flow-board { display: flex; gap: 16px; overflow-x: auto; padding: 4px 4px 14px; align-items: flex-start; }
.flow-col { display: grid; gap: 12px; min-width: 250px; max-width: 270px; flex: none; }
.flow-col-h { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.flow-node { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 6px; cursor: pointer; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s; }
.flow-node:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16, 40, 36, .12); }
.flow-node.t-menu { border-left-color: var(--blue); }
.flow-node.t-pergunta { border-left-color: #f0a422; }
.flow-node.t-mensagem { border-left-color: #b9c6c3; }
.flow-node.t-atendente { border-left-color: var(--brand); background: #f3faf9; }
.flow-node.start { outline: 2px solid var(--brand-50); }
.flow-node.flash { box-shadow: 0 0 0 4px #ffd46b; }
.flow-title { font-size: 14px; }
.flow-text { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.flow-opts { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 12.5px; }
.flow-opts li { display: flex; flex-direction: column; }
.flow-link { font-size: 11.5px; font-weight: 600; color: var(--brand); cursor: pointer; }
.flow-handoff { background: #fff; border-radius: 8px; padding: 6px 8px; line-height: 1.5; }
.flow-test { position: sticky; top: 76px; }
.opt-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 6px; counter-increment: opt; }
#optList { counter-reset: opt; }
@media (max-width: 1100px) { .flow-shell { grid-template-columns: 1fr; } .flow-test { position: static; } }

.flow-node.t-cep { border-left-color: var(--brand); }
.wa-ai { gap: 6px; }
.tpl-list { display: grid; gap: 14px; }
.tpl { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.tpl-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tpl-btns span { border: 1px solid #b7d7d4; color: var(--brand); border-radius: 8px; padding: 3px 10px; font-size: 12.5px; font-weight: 600; }
.tpl-body { flex: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; }

/* ============ CELULAR: menu vira gaveta, barra de cima fixa, janelas na largura da tela ============ */
.nav-close { display: none; }
@media (max-width: 900px) {
  .shell, body.nav-hidden .shell { grid-template-columns: 1fr; }
  /* menu lateral escondido; o ☰ abre como gaveta por cima do conteúdo */
  .sidebar, body.nav-hidden .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 70; width: min(300px, 86vw); height: 100%;
    display: flex; visibility: visible; overflow-y: auto;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 14px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-105%); transition: transform .22s ease;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(8, 24, 21, .45); z-index: 65; }
  body.nav-open { overflow: hidden; }
  #nav { flex-direction: column; flex-wrap: nowrap; }
  .sidebar .brand { margin-bottom: 14px; padding: 10px; }
  .sidebar .brand img { height: 44px; }
  .nav-close { display: inline-grid; position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); right: 8px; z-index: 2; background: var(--brand); box-shadow: 0 2px 8px rgba(0,0,0,.2); color: #fff; border: 0; width: 34px; height: 34px; border-radius: 10px; place-items: center; font-size: 16px; }
  .topbar { padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; gap: 8px; }
  .topbar .search { flex: 1; min-width: 0; }
  .topbar .spacer { display: none; }
  .view { padding: 18px 14px 80px; }
  .page-head { margin-bottom: 16px; align-items: flex-start; }
  .page-head h1 { font-size: 24px; }
  .card { padding: 14px; border-radius: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  /* campos com 16px: o iPhone não dá zoom ao tocar */
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; }
  /* janelas: ocupam a largura e sobem de baixo, como no celular */
  .modal { padding: 0; place-items: end stretch; }
  .modal-card { width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .modal-foot { position: sticky; bottom: -18px; background: #fff; padding-top: 10px; margin-top: 12px; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
  .toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); max-width: none; }
  .tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tabs a { white-space: nowrap; }
  .inbox-bar .search.sm { flex: 1 1 100%; }
  .kanban { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; }
  .kanban .col { scroll-snap-align: start; }
  /* WhatsApp: lista ou conversa (uma de cada vez), conversa com altura da tela */
  .wa-list, .wa-conv { max-height: none; }
  .wa-conv { min-height: calc(100dvh - 190px); padding: 10px; }
  .wa-msgs { min-height: 50vh; max-height: 62vh; padding: 10px; }
  .wa-msg { max-width: 88%; }
  .wa-tools .btn { flex: 1 1 auto; justify-content: center; }
  .wa-reply { position: sticky; bottom: 0; background: var(--panel, #fff); padding-top: 6px; }
  .wa-phone .wa-msgs { height: 52vh; }
  .wa-ai .btn { flex: 1 1 auto; justify-content: center; }
  /* mapa: colunas mais estreitas, rolando de lado */
  .flow-col { min-width: 80vw; max-width: 80vw; }
  .opt-row { grid-template-columns: 1fr; }
  .step, .task { flex-wrap: wrap; }
  table { font-size: 13px; }
}
@media (max-width: 420px) {
  .kpis .kpi-ico { display: none; }
  .kpis .kpi > span:first-child { padding-right: 0; font-size: 12.5px; }
  .page-head .row { width: 100%; }
  .page-head .row > .btn, .page-head .row > select { flex: 1 1 auto; }
}
@media (max-width: 900px) {
  /* dentro de uma conversa do WhatsApp, a conversa ocupa a tela (o ← volta para a lista) */
  .view:has(.wa-shell.has-conv) > .page-head { display: none; }
  .wa-head { flex-wrap: wrap; }
}

/* logo CRMITI (letras + rostinho, proporção ~5:1) */
.brand img.logo-crmiti { height: auto; width: 100%; max-width: 200px; }
.sidebar .brand img.logo-crmiti { height: auto; width: 100%; max-width: 172px; display: block; }
.sidebar .brand { overflow: visible; }
.login-card .brand img.logo-crmiti { height: auto; max-width: 260px; }
@media (max-width: 900px) { .sidebar .brand img.logo-crmiti { max-width: 170px; } }

/* cadastro de empresa/contato: sugestões enquanto digita */
.co-sug { display: grid; gap: 4px; margin-top: 6px; }
.co-item { display: grid; gap: 2px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; font: inherit; color: inherit; }
.co-item:hover, .co-item:focus-visible { border-color: var(--brand); background: var(--brand-50); }
.co-new { display: flex; gap: 6px; align-items: center; color: var(--brand); border-style: dashed; }
.co-picked { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: #fbfdfd; }
.co-contact { font-size: 13px; padding: 4px 0; border-top: 1px solid var(--line-2); }

/* Hoje: "Para responder" (linha inteira clicável) */
a.reply-row { color: inherit; text-decoration: none; }
a.reply-row:hover { background: #f5faf9; text-decoration: none; }

.jstep.next.none .jnum { color: var(--coral); border-color: var(--coral); }
.jstep.next.none .jbody { background: var(--coral-l); }

/* Acompanhamento: cartões por pessoa e tabela */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.person { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 8px; cursor: pointer; font: inherit; color: inherit; box-shadow: var(--shadow); }
.person:hover { border-color: var(--brand); }
.person.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.person-nums { display: grid; gap: 2px; font-size: 13px; color: var(--ink-2); }
.person-nums .hot { color: var(--red, #e5533d); }
.person .late { color: var(--red, #e5533d); font-weight: 600; }
.gestao-table td { vertical-align: middle; }
.gestao-table tr.late-row td:first-child { box-shadow: inset 4px 0 0 var(--red, #e5533d); }
.rules { display: grid; gap: 6px; }
.rule { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; font-size: 13.5px; }
