/* ============================================================================
   ALMEIDA CONNECT — MÓDULO COMERCIAL — comercial.css
   Design system isolado com prefixo .cm- para evitar conflitos
   ============================================================================ */

.cm-scope {
  --cm-primary: #2E2EF9;
  --cm-primary-dark: #1F1FC9;
  --cm-secondary: #111111;
  --cm-bg: #F5F6FA;
  --cm-card-bg: #FFFFFF;
  --cm-border: #E5E7EB;
  --cm-text: #1F2937;
  --cm-muted: #6B7280;
  --cm-success: #10B981;
  --cm-warning: #F59E0B;
  --cm-danger: #EF4444;
  --cm-info: #06B6D4;
  --cm-purple: #8B5CF6;
  --cm-orange: #F97316;
  --cm-radius-card: 12px;
  --cm-radius-input: 8px;
  --cm-shadow: 0 4px 16px rgba(0,0,0,0.08);
  --cm-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  font-family: var(--cm-font);
  color: var(--cm-text);
  background: var(--cm-bg);
  min-height: 100%;
}
.cm-scope *, .cm-scope *::before, .cm-scope *::after { box-sizing: border-box; }
.cm-scope button { font-family: inherit; cursor: pointer; border: 0; }
.cm-scope a { color: var(--cm-primary); text-decoration: none; }

.cm-page { padding: 28px 32px; max-width: 1400px; margin: 0 auto; }
.cm-page-header { margin-bottom: 22px; display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.cm-page-title { font-size: 24px; font-weight: 800; color: var(--cm-secondary); margin: 0 0 4px 0; }
.cm-page-subtitle { font-size: 13px; color: var(--cm-muted); margin: 0; }

/* Botões */
.cm-btn { display:inline-flex; align-items:center; gap:6px; padding:9px 16px;
  border-radius: var(--cm-radius-input); font-size: 13px; font-weight: 600; transition: all .15s; }
.cm-scope .cm-btn-primary { background: var(--cm-primary); color: white; }
.cm-scope .cm-btn-primary:hover { background: var(--cm-primary-dark); }
.cm-scope .cm-btn-secondary { background: white; color: var(--cm-text); border: 1px solid var(--cm-border); }
.cm-scope .cm-btn-secondary:hover { background: var(--cm-bg); }
.cm-scope .cm-btn-danger { background: var(--cm-danger); color: white; }
.cm-btn-sm { padding: 5px 10px; font-size: 12px; }

/* Cards */
.cm-card { background: white; border-radius: var(--cm-radius-card); box-shadow: var(--cm-shadow);
  border: 1px solid var(--cm-border); overflow: hidden; }
.cm-card-header { padding: 16px 20px; border-bottom: 1px solid var(--cm-border);
  display:flex; align-items:center; justify-content:space-between; }
.cm-card-title { font-size: 14px; font-weight: 700; color: var(--cm-secondary); margin: 0; }
.cm-card-body { padding: 20px; }

/* KPIs */
.cm-kpi-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px,1fr));
  gap:14px; margin-bottom:24px; }
.cm-kpi { background: white; border-radius: var(--cm-radius-card); padding: 18px;
  box-shadow: var(--cm-shadow); border: 1px solid var(--cm-border); }
.cm-kpi-label { font-size: 10px; font-weight: 700; color: var(--cm-muted);
  text-transform: uppercase; letter-spacing: .05em; }
.cm-kpi-value { font-size: 26px; font-weight: 800; color: var(--cm-secondary); margin: 6px 0 3px 0; }
.cm-kpi-value.cm-primary { color: var(--cm-primary); }
.cm-kpi-value.cm-success { color: var(--cm-success); }
.cm-kpi-value.cm-warning { color: var(--cm-warning); }
.cm-kpi-hint { font-size: 11px; color: var(--cm-muted); }

/* Tabelas */
.cm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cm-table th { background: var(--cm-bg); color: var(--cm-muted); font-weight: 700;
  text-align: left; padding: 10px 14px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .03em; border-bottom: 1px solid var(--cm-border); }
.cm-table td { padding: 12px 14px; border-bottom: 1px solid var(--cm-border); }
.cm-table tr:hover td { background: #FAFBFC; }

/* Badges */
.cm-badge { display:inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; }
.cm-badge-primary { background: rgba(46,46,249,.1); color: var(--cm-primary); }
.cm-badge-success { background: rgba(16,185,129,.1); color: var(--cm-success); }
.cm-badge-warning { background: rgba(245,158,11,.15); color: #B45309; }
.cm-badge-danger  { background: rgba(239,68,68,.1); color: var(--cm-danger); }
.cm-badge-info    { background: rgba(6,182,212,.1); color: var(--cm-info); }
.cm-badge-muted   { background: rgba(107,114,128,.1); color: var(--cm-muted); }
.cm-badge-purple  { background: rgba(139,92,246,.1); color: var(--cm-purple); }

/* Avatar */
.cm-avatar { width: 32px; height: 32px; border-radius: 50%;
  display:inline-flex; align-items:center; justify-content:center;
  color: white; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.cm-avatar-sm { width: 24px; height: 24px; font-size: 10px; }

/* Kanban */
.cm-kanban-scroll { overflow-x: auto; padding-bottom: 12px; }
.cm-kanban { display:flex; gap: 12px; min-width: max-content; }
.cm-kanban-col { width: 280px; background: #F5F6FA; border-radius: 12px; padding: 12px; flex-shrink: 0; }
.cm-kanban-col-header { display:flex; align-items:center; justify-content:space-between;
  padding: 4px 6px 10px 6px; }
.cm-kanban-col-title { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; display:flex; align-items:center; gap:8px; }
.cm-kanban-col-title .cm-dot { width: 8px; height: 8px; border-radius: 50%; }
.cm-kanban-col-count { background: white; color: var(--cm-muted); padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 700; }
.cm-kanban-col-total { font-size: 11px; color: var(--cm-muted); font-weight: 600;
  padding: 0 6px 8px 6px; }
.cm-kanban-card { background: white; padding: 12px; border-radius: 10px; margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); border-left: 3px solid var(--cm-primary); cursor: pointer; transition: all .15s; }
.cm-kanban-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.cm-kanban-card-title { font-size: 13px; font-weight: 600; color: var(--cm-secondary);
  margin-bottom: 6px; line-height: 1.3; }
.cm-kanban-card-lead { font-size: 11px; color: var(--cm-muted); margin-bottom: 6px; }
.cm-kanban-card-footer { display:flex; justify-content:space-between; align-items:center; margin-top: 8px; }
.cm-kanban-card-valor { font-size: 13px; font-weight: 700; color: var(--cm-primary); }

/* Progress bar */
.cm-progress { background: #E5E7EB; border-radius: 999px; height: 8px; overflow: hidden; }
.cm-progress-bar { background: var(--cm-primary); height: 100%; border-radius: 999px; transition: width .3s; }

/* Layouts */
.cm-cols-2 { display:grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.cm-cols-3 { display:grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.cm-cols-4 { display:grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .cm-cols-2, .cm-cols-3, .cm-cols-4 { grid-template-columns: 1fr; } }

/* Funil */
.cm-funil-item { display:flex; align-items:center; gap: 12px; padding: 8px 0; }
.cm-funil-label { min-width: 140px; font-size: 12px; font-weight: 600; }
.cm-funil-bar { flex: 1; background: #E5E7EB; border-radius: 6px; height: 28px;
  position: relative; overflow: hidden; }
.cm-funil-fill { position:absolute; top: 0; left: 0; height: 100%; border-radius: 6px;
  display:flex; align-items:center; padding-left: 10px; color: white; font-weight: 700; font-size: 11px; }
.cm-funil-valor { min-width: 100px; text-align: right; font-size: 12px;
  color: var(--cm-muted); font-weight: 600; }

/* Formulários */
.cm-form-group { margin-bottom: 14px; }
.cm-label { display:block; font-size: 12px; font-weight: 600; color: var(--cm-text); margin-bottom: 6px; }
.cm-input, .cm-select, .cm-textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-input); font-size: 13px; font-family: inherit;
  background: white; color: var(--cm-text); transition: border-color .15s;
}
.cm-input:focus, .cm-select:focus, .cm-textarea:focus {
  outline: none; border-color: var(--cm-primary);
  box-shadow: 0 0 0 3px rgba(46,46,249,.15);
}
.cm-textarea { min-height: 90px; resize: vertical; }

/* Atividade item */
.cm-atividade { display:flex; align-items:flex-start; gap: 12px; padding: 12px;
  background: white; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--cm-border); }
.cm-atividade-icon { width: 36px; height: 36px; border-radius: 8px;
  display:flex; align-items:center; justify-content:center; flex-shrink: 0; font-size: 15px; }
.cm-atividade-body { flex: 1; }
.cm-atividade-titulo { font-size: 13px; font-weight: 600; color: var(--cm-secondary); }
.cm-atividade-meta { font-size: 11px; color: var(--cm-muted); margin-top: 2px; }
.cm-atividade-tempo { font-size: 11px; color: var(--cm-muted); text-align: right; white-space: nowrap; }

.cm-bucket-header { font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: var(--cm-muted); margin: 20px 0 10px 0; padding-bottom: 6px; border-bottom: 1px solid var(--cm-border); }
.cm-bucket-header.cm-atrasada { color: var(--cm-danger); }
.cm-bucket-header.cm-hoje { color: var(--cm-primary); }

/* Modelo card */
.cm-modelo-card { border: 2px solid var(--cm-border); border-radius: 12px; padding: 20px;
  cursor: pointer; transition: all .15s; background: white; }
.cm-modelo-card:hover { border-color: var(--cm-primary); background: #F5F6FF; }
.cm-modelo-tipo { font-size: 10px; color: var(--cm-muted); text-transform: uppercase;
  letter-spacing: .05em; font-weight: 700; }
.cm-modelo-nome { font-size: 15px; font-weight: 700; color: var(--cm-secondary); margin: 6px 0; }
.cm-modelo-valor { font-size: 22px; font-weight: 800; color: var(--cm-primary); margin: 8px 0; }
.cm-modelo-desc { font-size: 12px; color: var(--cm-muted); line-height: 1.4; }

/* Meta item */
.cm-meta-item { padding: 14px 0; border-bottom: 1px solid var(--cm-border); }
.cm-meta-item:last-child { border-bottom: 0; }
.cm-meta-header { display:flex; align-items:center; gap: 12px; margin-bottom: 8px; }
.cm-meta-info { flex: 1; }
.cm-meta-nome { font-size: 13px; font-weight: 700; color: var(--cm-secondary); }
.cm-meta-cargo { font-size: 11px; color: var(--cm-muted); }
.cm-meta-valor { text-align: right; }
.cm-meta-valor .cm-realizado { font-size: 14px; font-weight: 700; color: var(--cm-primary); }
.cm-meta-valor .cm-total { font-size: 11px; color: var(--cm-muted); }

/* Upload */
.cm-upload { border: 2px dashed var(--cm-border); border-radius: 12px;
  padding: 40px; text-align: center; background: white; cursor: pointer; transition: all .15s; }
.cm-upload:hover { border-color: var(--cm-primary); background: #F5F6FF; }

/* Hint box */
.cm-hint { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF;
  padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 20px;
  display:flex; align-items:center; gap: 10px; }

/* Toast */
.cm-toast { position: fixed; bottom: 24px; right: 24px; background: var(--cm-secondary);
  color: white; padding: 12px 20px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); display: none; z-index: 9999; }
.cm-toast.cm-show { display: block; animation: cm-slideUp .3s; }
@keyframes cm-slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Modal */
.cm-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; align-items:center; justify-content:center; z-index: 9998; padding: 20px; }
.cm-modal-backdrop.cm-open { display: flex; }
.cm-modal { background: white; border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; }
.cm-modal-header { padding: 18px 22px; border-bottom: 1px solid var(--cm-border);
  display:flex; justify-content:space-between; align-items:center; }
.cm-modal-body { padding: 22px; }
.cm-modal-footer { padding: 16px 22px; border-top: 1px solid var(--cm-border);
  display:flex; justify-content:flex-end; gap: 10px; }
.cm-modal-close { background: none; border: 0; font-size: 22px; color: var(--cm-muted); cursor: pointer; }

/* Loading */
.cm-loading { padding: 40px; text-align: center; color: var(--cm-muted); font-size: 13px; }
.cm-empty { padding: 40px; text-align: center; color: var(--cm-muted); font-size: 13px; }

/* Utilitários */
.cm-hidden { display: none !important; }
.cm-mt-16 { margin-top: 16px; } .cm-mb-16 { margin-bottom: 16px; }
