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

/* ── TOOLBAR ── */
.crm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 18px 0;
  flex-wrap: wrap;
}
.crm-view-toggle {
  display: flex;
  background: var(--s2);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.crm-vbtn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border: none; border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.crm-vbtn.active {
  background: var(--s1);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.crm-busca {
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--s1);
  color: var(--text);
  font-size: 12.5px;
  width: 180px;
  outline: none;
  transition: border-color .12s;
}
.crm-busca:focus { border-color: var(--ink); }
.crm-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;
}

/* ── KANBAN ── */
.crm-kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
  flex: 1;
}
.crm-col {
  min-width: 220px;
  max-width: 240px;
  flex-shrink: 0;
  background: var(--s2);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crm-col-hd {
  display: flex; align-items: center; gap: 7px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.crm-col-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.crm-col-title {
  font-size: 12px; font-weight: 600;
  color: var(--text); flex: 1;
}
.crm-col-count {
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  background: var(--s3);
  padding: 1px 7px;
  border-radius: 10px;
}
.crm-col-body { display: flex; flex-direction: column; gap: 7px; }
.crm-col-empty {
  font-size: 11.5px; color: var(--muted);
  text-align: center; padding: 16px 0;
}

/* ── CARD ── */
.crm-card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 12px;
  cursor: pointer;
  transition: box-shadow .13s, transform .1s;
  animation: fadeUp .25s cubic-bezier(.16,1,.3,1) both;
}
.crm-card:hover {
  box-shadow: 0 3px 12px rgba(0,0,0,.09);
  transform: translateY(-1px);
}
.crm-card-hd {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 6px;
  margin-bottom: 4px;
}
.crm-card-nome {
  font-size: 13px; font-weight: 600;
  color: var(--text); line-height: 1.3;
}
.crm-card-score {
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.crm-card-servico {
  font-size: 11.5px; color: var(--muted);
  margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crm-card-ft {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
}
.crm-card-origem {
  font-size: 10.5px; color: var(--muted);
  background: var(--s2); padding: 2px 7px;
  border-radius: 6px;
}
.crm-card-resp {
  display: flex; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--muted);
}

/* ── TABELA ── */
.crm-table-wrap { overflow-x: auto; flex: 1; }
.crm-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.crm-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.crm-tr {
  cursor: pointer;
  transition: background .1s;
}
.crm-tr:hover { background: var(--s2); }
.crm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  max-width: 180px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crm-td-nome { font-weight: 600; }
.crm-etapa-badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
  white-space: nowrap;
}
.crm-empty {
  text-align: center; color: var(--muted);
  padding: 40px 0; font-size: 13px;
}

/* ── DRAWER ── */
#crm-drawer {
  position: fixed; top: 0; right: -440px;
  width: 420px; height: 100vh;
  background: var(--s1);
  border-left: 1px solid var(--border);
  z-index: 300;
  display: flex; flex-direction: column;
  transition: right .28s cubic-bezier(.16,1,.3,1);
  overflow: hidden;
}
#crm-drawer.open { right: 0; }

.crm-drawer-hd {
  display: flex; align-items: center;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  gap: 10px; flex-shrink: 0;
}
#crm-drawer-title {
  flex: 1; font-size: 15px; font-weight: 700;
  color: var(--text);
}
.crm-drawer-close {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  padding: 4px; border-radius: 6px;
  transition: color .12s;
  display: flex;
}
.crm-drawer-close:hover { color: var(--text); }
.crm-drawer-del {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
  font-size: 11.5px;
  transition: color .12s;
  display: flex; align-items: center; gap: 4px;
}
.crm-drawer-del:hover { color: var(--red); }

#crm-drawer-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
}

/* ── DRAWER SECTIONS ── */
.ld-section {
  background: var(--s2);
  border-radius: 10px;
  padding: 14px 15px;
  margin-bottom: 8px;
}
.ld-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: 10px;
}
.ld-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.crm-avançar-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--s1);
  color: var(--text);
  font-size: 11.5px; font-weight: 500;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.crm-avançar-btn:hover {
  border-color: var(--ink);
  background: var(--s3);
}

/* Score */
.ld-score-row {
  display: flex; align-items: center; gap: 10px;
}
.ld-score-bar-wrap {
  flex: 1; height: 6px;
  background: var(--s3);
  border-radius: 10px; overflow: hidden;
}
.ld-score-bar {
  height: 100%; border-radius: 10px;
  transition: width .3s, background .3s;
}
.ld-score-val {
  font-size: 14px; font-weight: 700;
  min-width: 26px; text-align: right;
}
.ld-score-input {
  width: 52px; height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--s1); color: var(--text);
  font-size: 12px; text-align: center;
  outline: none;
  padding: 0 4px;
}
.ld-score-input:focus { border-color: var(--ink); }

/* Grid de dados */
.ld-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 10px;
}
.ld-field {
  display: flex; flex-direction: column; gap: 2px;
}
.ld-field-lbl {
  font-size: 10.5px; color: var(--muted); font-weight: 500;
}
.ld-field span:last-child {
  font-size: 12.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crm-edit-dados-btn {
  display: flex; align-items: center; gap: 5px;
  background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px;
  color: var(--muted); font-size: 11.5px;
  cursor: pointer; transition: color .12s, border-color .12s;
  margin-top: 4px;
}
.crm-edit-dados-btn:hover { color: var(--text); border-color: var(--ink); }

/* Anotações */
.ld-notas {
  width: 100%; min-height: 72px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text); font-size: 12.5px;
  padding: 9px 11px;
  resize: vertical; outline: none;
  font-family: inherit;
  transition: border-color .12s;
  box-sizing: border-box;
}
.ld-notas:focus { border-color: var(--ink); }
.ld-notas-ro {
  font-size: 12.5px; color: var(--text);
  line-height: 1.5;
}

/* Timeline */
.ld-timeline-item {
  display: flex; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.ld-timeline-item:last-child { border-bottom: none; }
.ld-tl-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 5px; flex-shrink: 0;
}
.ld-tl-dot.auto   { background: #6366f1; }
.ld-tl-dot.manual { background: #10b981; }
.ld-tl-body { flex: 1; }
.ld-tl-autor {
  font-size: 11.5px; font-weight: 600;
  color: var(--text); margin-bottom: 2px;
  display: flex; align-items: center; gap: 5px;
}
.ld-tl-badge-auto {
  font-size: 9.5px; font-weight: 700;
  background: rgba(99,102,241,.12); color: #6366f1;
  padding: 1px 5px; border-radius: 4px;
}
.ld-tl-texto { font-size: 12px; color: var(--text); line-height: 1.45; }
.ld-tl-data  { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

.ld-timeline-add {
  display: flex; gap: 7px;
  margin-top: 10px;
}
.ld-timeline-inp {
  flex: 1; height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--s1); color: var(--text);
  font-size: 12.5px; outline: none;
  transition: border-color .12s;
}
.ld-timeline-inp:focus { border-color: var(--ink); }
.crm-send-btn {
  width: 32px; height: 32px;
  border: none; border-radius: 7px;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: opacity .12s;
}
.crm-send-btn:hover { opacity: .85; }

/* ── MODAL CRIAR/EDITAR ── */
#crm-modal .modal {
  width: 460px; max-width: 95vw;
}
.crm-modal-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.crm-modal-grid .form-group.full { grid-column: 1 / -1; }

/* dark mode adjustments */
body.dark .crm-card { background: var(--s2); }
body.dark .crm-col  { background: var(--s3); }
