/* ── contatos.css — Akino Systems ── */

/* ══════════════════════════════════════════
   TOOLBAR
══════════════════════════════════════════ */
.contatos-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 14px 0;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.ct-tb-left  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ct-tb-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.ct-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.ct-search-icon {
  position: absolute;
  left: 10px;
  color: var(--muted);
  pointer-events: none;
}
.ct-busca {
  height: 32px;
  padding: 0 11px 0 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--s1);
  color: var(--text);
  font-size: 12.5px;
  width: 200px;
  outline: none;
  transition: border-color .12s;
}
.ct-busca:focus { border-color: var(--ink); }

.ct-filters { display: flex; gap: 6px; }
.ct-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--s1);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
}

.ct-count {
  font-size: 12px;
  color: var(--muted);
  padding-left: 4px;
}

.ct-btn-primary {
  display: flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: none; border-radius: 7px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: opacity .12s;
}
.ct-btn-primary:hover { opacity: .85; }

.ct-btn-secondary {
  display: flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--s1);
  color: var(--text);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.ct-btn-secondary:hover { border-color: var(--ink); background: var(--s2); }

/* ══════════════════════════════════════════
   TABLE WRAPPER
══════════════════════════════════════════ */
.contatos-table-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 0;
}

.ct-table-scroll {
  flex: 1;
  overflow: auto;
}

/* ══════════════════════════════════════════
   TABLE
══════════════════════════════════════════ */
.ct-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

/* ── HEADER ── */
.ct-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--s2);
}
.ct-table thead tr {
  border-bottom: 1px solid var(--border);
}
.ct-th {
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .45px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color .12s;
  text-align: left;
}
.ct-th:hover { color: var(--text); }
.ct-th--active { color: var(--text); }
.ct-th-check { width: 36px; padding: 9px 0 9px 14px; cursor: default; }

/* ── BODY ── */
.ct-tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  cursor: default;
  animation: ctFadeIn .2s ease both;
}
.ct-tr:last-child { border-bottom: none; }
.ct-tr:hover { background: var(--s2); }
.ct-tr--selected { background: rgba(99,102,241,.05); }
.ct-tr--selected:hover { background: rgba(99,102,241,.09); }

@keyframes ctFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ct-td {
  padding: 10px 12px;
  color: var(--text);
  vertical-align: middle;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ct-td-check  { width: 36px; padding: 10px 0 10px 14px; }
.ct-td-center { text-align: center; }
.ct-td-right  { text-align: right; }
.ct-td-date   { color: var(--muted); font-size: 12px; cursor: pointer; }
.ct-td-value  { font-weight: 600; font-size: 12.5px; cursor: pointer; }
.ct-td-actions { width: 40px; padding: 10px 8px; text-align: right; }

/* ── CONTACT CELL ── */
.ct-td-contact {
  cursor: pointer;
  min-width: 200px;
}
.ct-td-contact:hover .ct-contact-name { text-decoration: underline; text-decoration-color: var(--muted); }

.ct-contact-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .3px;
}
.ct-td-contact .ct-td { display: flex; align-items: center; gap: 9px; }

/* Fix: direct children of ct-td need flex */
td.ct-td-contact {
  display: table-cell; /* keep as table-cell */
}
td.ct-td-contact > div, td.ct-td-contact {
  vertical-align: middle;
}

.ct-contact-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
.ct-contact-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ct-contact-name {
  font-size: 13px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .12s;
}
.ct-contact-sub {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── SERVICE CELL ── */
.ct-service-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}
.ct-service-name {
  font-size: 12.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px; display: block;
}
.ct-origin-tag {
  display: inline-flex; align-items: center;
  font-size: 10.5px; color: var(--muted);
  background: var(--s3);
  padding: 1px 6px;
  border-radius: 5px;
  width: fit-content;
}

/* ── RESP CELL ── */
.ct-resp-cell {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer;
}
.ct-resp-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--s3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.ct-resp-name {
  font-size: 12.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 110px; display: block;
}

/* ── ETAPA BADGE ── */
.ct-etapa-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 3px 9px;
  border-radius: 7px;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}

/* ── WIN PROBABILITY BAR ── */
.ct-prob-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
}
.ct-prob-bar {
  display: flex;
  gap: 2px;
  align-items: center;
}
.ct-prob-seg {
  width: 6px; height: 10px;
  border-radius: 2px;
  background: var(--s3);
  border: 1px solid var(--border);
  transition: background .2s;
}
.ct-prob-seg--on {
  border-color: transparent;
}
.ct-prob-pct {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  min-width: 28px;
  text-align: left;
}

/* ── SPARKLINE ── */
.ct-sparkline {
  display: block;
  cursor: pointer;
}

/* ── ACTION BTN ── */
.ct-action-btn {
  width: 26px; height: 26px;
  border: none; border-radius: 6px;
  background: transparent;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, background .12s, color .12s;
}
.ct-tr:hover .ct-action-btn { opacity: 1; }
.ct-action-btn:hover { background: var(--s3); color: var(--text); }

/* ── CHECKBOX ── */
.ct-checkbox {
  width: 14px; height: 14px;
  cursor: pointer;
  accent-color: var(--ink);
}

/* ── FOOTER ── */
.ct-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--s2);
  font-size: 11.5px;
  color: var(--muted);
  flex-shrink: 0;
}
.ct-sel-info {
  background: rgba(99,102,241,.1);
  color: var(--text);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
}

/* ── EMPTY STATE ── */
.ct-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 72px 24px;
  flex: 1;
  text-align: center;
}
.ct-empty-icon {
  color: var(--muted);
  opacity: .35;
  margin-bottom: 4px;
}
.ct-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ct-empty-sub {
  font-size: 12.5px;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.5;
}
.ct-empty-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--s1);
  color: var(--text);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.ct-empty-btn:hover { border-color: var(--ink); background: var(--s2); }

/* ══════════════════════════════════════════
   DARK MODE
══════════════════════════════════════════ */
body.dark .contatos-table-wrap {
  background: var(--s2);
}
body.dark .ct-table thead {
  background: var(--s3);
}
body.dark .ct-tr--selected {
  background: rgba(99,102,241,.08);
}
