/* crm · contatos e ficha 360 (tokens do style.css: grafite + laranja da marca) */
#tab-contatos { display: flex; flex-direction: column; gap: 18px; }
#tab-contatos.hidden { display: none !important; }
.ct-acts { gap: 8px; }
.ct-acts .btn { min-height: 40px; }
.ct-n { display: grid; place-items: center; min-width: 20px; padding: 1px 6px; border-radius: 6px; background: var(--alb); color: var(--al); font-size: 11px; }
.err-t { color: var(--er); } .warn-t { color: var(--al); }
.girando, .girando > i { animation: ctGira .8s linear infinite; }
@keyframes ctGira { to { transform: rotate(360deg); } }

/* barra de filtros */
.ct-barra { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: center; gap: 10px; }
.ct-busca { position: relative; display: block; }
.ct-busca i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--mt2); font-size: 17px; pointer-events: none; }
.ct-busca input { padding-left: 38px; }
.ct-ciclos { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-ciclos .chip { min-height: 40px; padding: 7px 11px; }
.ct-sel { display: flex; gap: 8px; align-items: center; }
.ct-sel .campo { min-height: 40px; width: auto; max-width: 190px; padding: 8px 10px; font-size: 12px; }
.ct-sel .icon-btn { width: 40px; height: 40px; }

/* ações em massa */
.ct-massa { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--acbd); border-radius: 12px; background: var(--acb); }
.ct-massa > b { font-size: 13px; }
.ct-massa .campo { width: 180px; min-height: 38px; padding: 8px 10px; }
.ct-massa .btn { min-height: 38px; }

/* lista */
.ct-lista { display: flex; flex-direction: column; border: 1px solid var(--bd); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.ct-lista > .skeleton { min-height: 62px; margin: 8px; }
.ct-cab, .ct-linha { display: grid; grid-template-columns: 36px minmax(220px, 2.2fr) 96px minmax(120px, 1.1fr) minmax(130px, 1.2fr) minmax(110px, 1fr) 96px; align-items: center; gap: 12px; padding: 0 16px; }
.ct-cab { min-height: 42px; color: var(--mt2); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--bd); background: rgba(255, 255, 255, .012); }
.ct-linha { min-height: 66px; border-bottom: 1px solid rgba(255, 255, 255, .045); cursor: pointer; transition: background var(--ease); }
.ct-linha:last-child { border-bottom: 0; }
.ct-linha.sel { background: rgba(255, 106, 0, .055); }
.ct-linha:focus-visible { outline: 2px solid var(--ac2); outline-offset: -2px; }
.ct-ck { display: grid; place-items: center; width: 36px; height: 44px; cursor: pointer; }
.ct-ck input { width: 17px; height: 17px; min-height: 0; padding: 0; accent-color: var(--ac); cursor: pointer; }
.ct-emp { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ct-emp-t { display: flex; flex-direction: column; min-width: 0; }
.ct-emp-t b { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ct-emp-t small, .ct-c-neg small, .ct-c-prox small { overflow: hidden; color: var(--mt); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ct-c-neg, .ct-c-prox { display: flex; flex-direction: column; min-width: 0; font-size: 12px; }
.ct-c-neg b { font-weight: 500; }
.ct-c-prox > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-c-tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ct-c-ult { color: var(--mt); font-size: 12px; text-align: right; }
.ct-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--bd); border-radius: 20px; background: rgba(255, 255, 255, .03); color: #c4cbd6; font-size: 11px; white-space: nowrap; }
.ct-tag button { display: grid; place-items: center; width: 16px; height: 16px; margin-right: -4px; border-radius: 50%; color: var(--mt); font-size: 11px; }
.ct-tag.add { border-style: dashed; color: var(--ac2); cursor: pointer; }
.ct-tag-in { width: 140px; min-height: 28px; padding: 3px 10px; border-radius: 20px; font-size: 12px; }

/* avatar com cor estável por nome */
.ct-av { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; background: color-mix(in srgb, var(--c) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); color: color-mix(in srgb, var(--c) 70%, #fff); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.ct-av.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.ct-av.xl { width: 58px; height: 58px; border-radius: 16px; font-size: 20px; }

.ct-vazio { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 24px; text-align: center; }
.ct-vazio > i { display: grid; place-items: center; width: 64px; height: 64px; border: 1px solid var(--acbd); border-radius: 18px; background: var(--acb); color: var(--ac2); font-size: 32px; }
.ct-vazio h3 { font-size: 18px; }
.ct-vazio p { max-width: 46ch; }
.ct-vazio.sm { padding: 32px 16px; }
.ct-vazio.sm > i { width: 48px; height: 48px; font-size: 24px; }

/* ficha 360: painel lateral */
body.ct-trava { overflow: hidden; }
.ct360 { position: fixed; inset: 0; z-index: 32; display: none; }
.ct360.aberto { display: block; }
.ct360-fundo { position: absolute; inset: 0; background: rgba(4, 6, 9, .62); backdrop-filter: blur(4px); }
.ct360-painel { position: absolute; inset: 0 0 0 auto; display: flex; flex-direction: column; width: min(760px, 100%); height: 100dvh; overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--bd2); background: var(--bg); box-shadow: -24px 0 80px rgba(0, 0, 0, .45); }
.ct360-carregando { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.ct360-cab { position: relative; display: flex; flex-direction: column; gap: 16px; padding: 28px 28px 20px; background: radial-gradient(120% 80% at 0% 0%, rgba(255, 106, 0, .09), transparent 60%), var(--side); border-bottom: 1px solid var(--bd); }
.ct360-x { position: absolute; top: 14px; right: 14px; }
.ct360-id { display: flex; align-items: center; gap: 16px; padding-right: 44px; }
.ct360-nome { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ct360-nome .pill { width: fit-content; }
.ct360-nome h2 { font-size: clamp(20px, 2.4vw, 26px); letter-spacing: -.03em; line-height: 1.15; overflow-wrap: anywhere; }
.ct360-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ct360-acoes { display: flex; flex-wrap: wrap; gap: 8px; }
.ct360-acoes .btn { min-height: 38px; }
.ct360-numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--bd); border-bottom: 1px solid var(--bd); }
.ct360-numeros > div { display: flex; flex-direction: column; gap: 3px; padding: 14px 18px; background: var(--bg); }
.ct360-numeros span { color: var(--mt2); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.ct360-numeros b { display: flex; flex-direction: column; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ct360-numeros b small { color: var(--mt); font-size: 11px; font-weight: 500; }
.ct360-abas { position: sticky; top: 0; z-index: 2; display: flex; gap: 2px; overflow-x: auto; padding: 0 20px; border-bottom: 1px solid var(--bd); background: rgba(12, 14, 18, .94); backdrop-filter: blur(12px); scrollbar-width: none; }
.ct360-abas::-webkit-scrollbar { display: none; }
.ct360-abas button { display: inline-flex; align-items: center; gap: 7px; min-height: 50px; padding: 0 12px; color: var(--mt); font-size: 13px; font-weight: 500; white-space: nowrap; }
.ct360-abas button.on { color: var(--tx); }
.ct360-abas button i { font-size: 16px; }
.ct360-abas .n { display: grid; place-items: center; min-width: 20px; padding: 1px 6px; border-radius: 6px; background: var(--sf3); color: var(--mt); font-size: 10px; }
.ct360-abas button.on .n { background: var(--acb); color: var(--ac2); }
.ct360-ind { position: absolute; bottom: -1px; left: 0; height: 2px; border-radius: 2px; background: var(--ac); box-shadow: 0 0 12px rgba(255, 106, 0, .6); pointer-events: none; }
.ct360-corpo { display: flex; flex-direction: column; gap: 16px; padding: 22px 28px calc(40px + env(safe-area-inset-bottom)); }
.ct-h3 { margin: 6px 0 2px; color: var(--mt); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* composer e linha do tempo */
.ct-composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px; border: 1px solid var(--bd); border-radius: 14px; background: var(--sf); }
.ct-composer-l { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.ct-composer-l .campo { width: auto; min-height: 36px; padding: 6px 10px; font-size: 12px; }
.ct-composer textarea { min-height: 44px; resize: vertical; }
.ct-composer .btn { align-self: end; min-height: 44px; }
.ct-tl-filtros { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-tl-filtros .chip { min-height: 34px; padding: 5px 11px; font-size: 12px; }
.ct-tl, .ct-tl ol { list-style: none; margin: 0; padding: 0; }
.ct-tl-dia { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ct-tl-dia h4 { position: sticky; top: 50px; z-index: 1; width: fit-content; margin-left: 46px; padding: 3px 10px; border: 1px solid var(--bd); border-radius: 20px; background: var(--bg); color: var(--mt); font-size: 11px; font-weight: 500; }
.ct-tl-dia h4::first-letter { text-transform: uppercase; }
.ct-tl-dia > ol { position: relative; display: flex; flex-direction: column; gap: 4px; }
.ct-tl-dia > ol::before { content: ''; position: absolute; top: 6px; bottom: 6px; left: 17px; width: 1px; background: linear-gradient(var(--bd2), transparent); }
.ct-tl-it { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 8px 10px 8px 0; border-radius: 12px; }
.ct-tl-ic { position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--bd2); border-radius: 11px; background: var(--sf2); color: var(--mt); font-size: 17px; }
.ct-tl-it.g-conversa .ct-tl-ic { color: #7fb2f0; border-color: rgba(57, 135, 229, .4); background: rgba(57, 135, 229, .1); }
.ct-tl-it.g-funil .ct-tl-ic { color: var(--ac2); border-color: var(--acbd); background: var(--acb); }
.ct-tl-it.g-trabalho .ct-tl-ic { color: var(--ok2); border-color: var(--okbd); background: var(--okb); }
.ct-tl-it.g-nota .ct-tl-ic { color: var(--al); border-color: var(--albd); background: var(--alb); }
.ct-tl-it.futuro { border: 1px dashed var(--acbd); }
.ct-tl-c { min-width: 0; padding-top: 2px; }
.ct-tl-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ct-tl-h b { font-size: 13px; font-weight: 600; }
.ct-tl-c p { margin-top: 3px; color: #c6ccd6; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }

/* pessoas */
.ct-pessoas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ct-pessoa { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--bd); border-radius: 14px; background: var(--sf); }
.ct-pessoa-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.ct-pessoa-h > div { display: flex; flex-direction: column; min-width: 0; }
.ct-pessoa-h b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ct-pessoa-h .pill { width: fit-content; }
.ct-pessoa-d { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ct-pessoa-d > * { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; color: #c9d0da; text-decoration: none; }
.ct-pessoa-d a:hover { color: var(--ac2); }
.ct-pessoa-opt { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 10px; border-top: 1px solid var(--bd); }
.ct-pessoa.add { align-items: center; justify-content: center; min-height: 120px; border-style: dashed; color: var(--ac2); font-weight: 500; flex-direction: row; gap: 8px; }

/* interruptor */
label.ct-sw { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 10px; color: var(--tx) !important; font-size: 12px; cursor: pointer; }
.ct-sw input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.ct-sw span { position: relative; width: 34px; height: 20px; flex: none; border-radius: 20px; background: var(--sf3); border: 1px solid var(--bd2); transition: background var(--ease); }
.ct-sw span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--mt); transition: transform 200ms cubic-bezier(.22, 1, .36, 1), background var(--ease); }
.ct-sw input:checked + span { background: var(--acb); border-color: var(--acbd); }
.ct-sw input:checked + span::after { transform: translateX(14px); background: var(--ac); }
.ct-sw input:focus-visible + span { outline: 2px solid var(--ac2); outline-offset: 2px; }

/* negócios */
.ct-negs { display: flex; flex-direction: column; gap: 10px; }
.ct-neg { display: flex; flex-direction: column; gap: 12px; width: 100%; padding: 16px; border: 1px solid var(--bd); border-radius: 14px; background: var(--sf); text-align: left; }
.ct-neg-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ct-neg-trilha { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.ct-neg-trilha i { height: 5px; border-radius: 3px; background: var(--sf3); }
.ct-neg-trilha i.on { background: var(--ac); }
.ct-neg.ganho .ct-neg-trilha i.on { background: var(--ok); }
.ct-neg-trilha i.perd { background: var(--erbd); }
.ct-neg-d { display: flex; flex-wrap: wrap; gap: 6px 16px; color: #c6ccd6; font-size: 12px; }
.ct-neg-d span { display: inline-flex; align-items: center; gap: 6px; }

/* tarefas */
.ct-tars-acao { display: flex; justify-content: flex-end; }
.ct-tars { display: flex; flex-direction: column; gap: 6px; }
.ct-tar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--bd); border-radius: 11px; background: var(--sf); font-size: 13px; }
.ct-tar b { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ct-tar.atr { border-color: var(--erbd); }
.ct-feitas summary { cursor: pointer; padding: 8px 0; color: var(--mt); font-size: 12px; }

/* dados */
.ct-dados-acoes { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* importar, duplicados, campos */
.ct-drop { display: flex !important; flex-direction: column !important; align-items: center; justify-content: center; gap: 10px !important; min-height: 140px; padding: 20px; border: 1.5px dashed var(--bd2); border-radius: 14px; background: rgba(255, 255, 255, .015); color: var(--mt); text-align: center; cursor: pointer; }
.ct-drop i { color: var(--ac2); font-size: 34px; }
.ct-drop.on { border-color: var(--ac); background: var(--acb); }
.ct-imp-res { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ct-imp-res > div { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; border: 1px solid var(--bd); border-radius: 11px; }
.ct-imp-res b { font-size: 22px; font-variant-numeric: tabular-nums; }
.ct-imp-res span { color: var(--mt); font-size: 11px; }
.ct-dup { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--bd); border-radius: 13px; background: var(--sf); overflow: hidden; }
.ct-dup-par { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; }
.ct-dup-par > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ct-dup-par b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ct-dup-m, .ct-dup-a { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ct-campo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--bd); border-radius: 10px; }
.ct-campo span { display: flex; flex-direction: column; min-width: 0; }
.ct-campo small { color: var(--mt); font-size: 11px; }

@media (hover: hover) {
  .ct-linha:hover { background: rgba(255, 255, 255, .028); }
  .ct-neg:hover, .ct-pessoa:not(.add):hover { border-color: var(--bd2); }
  .ct-pessoa.add:hover, .ct-tag.add:hover { border-color: var(--ac); }
  .ct-tl-it:hover { background: rgba(255, 255, 255, .02); }
  .ct360-abas button:hover { color: var(--tx); }
}
@media (max-width: 1280px) {
  .ct-cab, .ct-linha { grid-template-columns: 36px minmax(200px, 2fr) 90px minmax(120px, 1.2fr) minmax(130px, 1.2fr) 90px; }
  .ct-cab > span:nth-child(6), .ct-c-tags { display: none; }
  .ct-barra { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .ct-acts .btn span { display: none; }
  .ct-acts .btn.primary span { display: inline; }
  .ct-cab { display: none; }
  .ct-linha { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "ck emp fase" ". neg ult"; row-gap: 4px; padding: 12px 12px 12px 6px; min-height: 0; }
  .ct-linha .ct-ck { grid-area: ck; width: 30px; }
  .ct-emp { grid-area: emp; }
  .ct-c-fase { grid-area: fase; }
  .ct-c-neg { grid-area: neg; flex-direction: row; gap: 8px; align-items: baseline; }
  .ct-c-ult { grid-area: ult; }
  .ct-c-prox, .ct-c-tags { display: none; }
  .ct-sel { flex-wrap: wrap; }
  .ct-sel .campo { flex: 1; max-width: none; }
  .ct360-cab { padding: calc(20px + env(safe-area-inset-top)) 18px 16px; }
  .ct360-x { top: calc(10px + env(safe-area-inset-top)); }
  .ct360-corpo { padding: 18px 16px calc(32px + env(safe-area-inset-bottom)); }
  .ct360-abas { padding: 0 8px; }
  .ct360-numeros { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ct360-numeros > div { padding: 12px; }
  .ct-pessoas { grid-template-columns: 1fr; }
  .ct-composer { grid-template-columns: 1fr; }
  .ct-composer .btn { width: 100%; }
  .ct-imp-res { grid-template-columns: repeat(2, 1fr); }
  .ct-tl-dia h4 { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .girando, .girando > i { animation: none; } .ct-sw span::after { transition: none; } }
.ct360-painel > * { flex-shrink: 0; }
.ct360-numeros { gap: 0; background: var(--bg); }
.ct360-numeros > div { border-right: 1px solid var(--bd); border-bottom: 1px solid var(--bd); margin: 0 -1px -1px 0; }
