/* style.css — estilos próprios do Capim Limão CRM (sem dependências externas / CDN). */

:root {
  /* Paleta oficial da marca — derivada da cor #3b4233 (logo Capim Limão), mantendo o nome das
     variáveis "--lime-*" pra não precisar mexer no resto do CSS. --lime-900 é a cor exata da logo;
     as demais são tons mais claros/escuros da mesma matiz, calculados pra manter contraste
     acessível (ex.: --lime-600 tem contraste >4.5:1 com texto branco, usado nos botões). */
  --lime-50: #f5f6f3;
  --lime-100: #e8ebe5;
  --lime-200: #d1d7cb;
  --lime-300: #aeb8a3;
  --lime-600: #677359;
  --lime-700: #525c47;
  --lime-800: #434b3a;
  --lime-900: #3b4233;
  --brand-accent: #c2410c; /* laranja do detalhe acima do "i" na logo — usado com moderação */
  --stone-50: #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-700: #44403c;
  --stone-800: #292524;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--stone-50);
  color: var(--stone-800);
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }

.min-h-screen { min-height: 100vh; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); padding: 32px; border: 1px solid var(--stone-200); }
.login-emoji { font-size: 40px; text-align: center; }
.login-logo { display: block; height: 76px; width: auto; margin: 0 auto 6px; }
.brand-logo { height: 34px; width: auto; display: block; background: #fff; border-radius: 8px; padding: 6px 12px; }
.login-title { text-align: center; font-weight: 700; font-size: 20px; color: var(--lime-800); margin: 4px 0 0; }
.login-sub { text-align: center; color: var(--stone-500); font-size: 14px; margin: 4px 0 20px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--stone-600); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--stone-300); border-radius: 10px; padding: 9px 12px; outline: none; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--lime-600); box-shadow: 0 0 0 3px var(--lime-100); }

.ficha-details { border: 1px solid var(--stone-200); border-radius: 12px; padding: 10px 14px; background: var(--stone-50); }
.ficha-details summary::-webkit-details-marker { color: var(--lime-700); }
.ficha-subhead { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--lime-800); margin: 18px 0 8px; }
.ficha-subhead:first-child { margin-top: 4px; }
.drive-folder-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-weight: 600; color: var(--lime-700); text-decoration: none; }
.drive-folder-link:hover { text-decoration: underline; }

.btn { border: none; border-radius: 10px; padding: 9px 16px; font-weight: 600; cursor: pointer; transition: background .15s; }
.btn-primary { background: var(--lime-600); color: #fff; }
.btn-primary:hover { background: var(--lime-700); }
.btn-dark { background: var(--stone-700); color: #fff; }
.btn-dark:hover { background: var(--stone-800); }
.btn-ghost { background: transparent; color: var(--stone-600); }
.btn-ghost:hover { background: var(--stone-100); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.error-text { color: #dc2626; font-size: 13px; margin-bottom: 8px; }

/* ---- layout ---- */
.topbar {
  background: var(--lime-700); color: #fff; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.nav { display: flex; gap: 4px; background: rgba(0,0,0,0.15); border-radius: 10px; padding: 4px; }
.drawer-tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--stone-100); border-radius: 10px; padding: 4px; margin: 10px 12px; }
.drawer-tabs button { background: transparent; border: none; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--stone-600); white-space: nowrap; }
.drawer-tabs button.active { background: #fff; color: var(--lime-800); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.nav button { background: transparent; border: none; color: #ecfccb; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; }
.nav button:hover { background: rgba(0,0,0,0.15); }
.nav button.active { background: #fff; color: var(--lime-800); }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.pill-btn { background: rgba(0,0,0,0.25); border: none; color: #fff; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.pill-btn:hover { background: rgba(0,0,0,0.4); }

.main-content { flex: 1; padding: 20px; }
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 16px; color: var(--stone-800); }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* ---- kanban ---- */
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; }
.kanban-col-wrap { flex: 1 1 0; min-width: 250px; }
.kanban-col-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding: 0 2px; }
.kanban-col-title { font-weight: 600; font-size: 14px; color: var(--stone-700); }
.count-badge { font-size: 11px; background: var(--stone-200); color: var(--stone-600); border-radius: 999px; padding: 2px 8px; }
.kanban-col { min-height: 60vh; background: rgba(231,229,228,0.5); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.kanban-empty { font-size: 12px; color: var(--stone-400); text-align: center; padding: 24px 0; }

.lead-card { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); border: 1px solid var(--stone-200); padding: 12px; cursor: pointer; transition: box-shadow .15s; }
.lead-card:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.lead-card.drag-ghost { opacity: 0.4; }
.lead-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.lead-card-name { font-weight: 600; font-size: 14px; color: var(--stone-800); margin: 0; }
.unit-badge { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.unit-buffet { background: #ffedd5; color: #9a3412; }
.unit-coquetelaria { background: var(--lime-100); color: var(--lime-800); }
.lead-card-meta { font-size: 12px; color: var(--stone-500); margin: 4px 0 0; }
.lead-card-value { font-size: 12px; font-weight: 600; color: var(--stone-700); margin: 6px 0 0; }

/* Aviso de sugestão automática de etapa (leads importados do histórico do WhatsApp) — nunca move o
   lead sozinho, só sugere; a cor âmbar sinaliza "precisa de atenção/decisão", diferente do laranja
   da unidade Buffet e do vermelho de não lidas. */
.suggestion-banner { margin-top: 8px; padding: 8px; border-radius: 8px; background: #fffbeb; border: 1px solid #fde68a; cursor: default; }
.suggestion-banner-text { font-size: 12px; color: #92400e; margin: 0; }
.suggestion-banner-reason { font-size: 11px; color: #a16207; margin: 3px 0 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.suggestion-banner-actions { display: flex; gap: 6px; margin-top: 6px; }
.btn-suggestion-accept, .btn-suggestion-dismiss { font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; }
.btn-suggestion-accept { background: var(--lime-800); color: #fff; }
.btn-suggestion-accept:hover { background: var(--lime-900); }
.btn-suggestion-dismiss { background: #fff; color: #92400e; border-color: #fde68a; }
.btn-suggestion-dismiss:hover { background: #fef3c7; }

/* ---- passo a passo do evento (drawer do lead e portal do cliente) ---- */
/* Grade responsiva em vez de uma linha só com conectores — evita o problema de um "—" ficar
   órfão sozinho numa linha quando os rótulos (que têm tamanhos bem diferentes) quebram. */
.event-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 14px;
  margin-top: 10px;
}
.event-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--stone-50);
  border: 1px solid var(--stone-100);
}
.event-step.done { background: #f0fdf4; border-color: #bbf7d0; }
.event-step-dot { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; background: var(--stone-200); color: var(--stone-600); font-size: 11px; font-weight: 700; flex-shrink: 0; }
.event-step.done .event-step-dot { background: #166534; color: #fff; }
.event-step-label { font-size: 12px; color: var(--stone-600); line-height: 1.25; }
.event-step.done .event-step-label { color: #166534; font-weight: 600; }

/* ---- anexos do lead (contrato / papelaria) ---- */
.attachment-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--stone-100); }
.attachment-row:first-child { border-top: none; }

/* ---- data da degustação em destaque no card do funil ---- */
.lead-card-tasting { color: #9333ea; font-weight: 600; }

/* ---- código do orçamento (identifica o lead em qualquer área) ---- */
.lead-card-code { font-size: 11px; font-weight: 700; letter-spacing: 0.3px; color: var(--stone-500); margin: 0 0 2px; }
.budget-code-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--stone-50); border: 1px solid var(--stone-100); border-radius: 8px; margin-bottom: 12px; }
.budget-code-box .code-value { font-size: 18px; font-weight: 800; letter-spacing: 0.5px; }
.budget-code-history { font-size: 12px; color: var(--stone-500); margin: 6px 0 12px; }
.budget-code-history li { list-style: none; padding: 2px 0; }

/* ---- badge de mensagens não lidas (notificação de WhatsApp) ---- */
.unread-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e11d48; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.nav-badge { margin-left: 6px; vertical-align: middle; }
.nav-badge.hidden { display: none; }
.lead-card-unread { position: absolute; top: -6px; right: -6px; }
.lead-card { position: relative; }

.status-badge { display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 999px; }
.status-novo { background: var(--stone-200); color: var(--stone-700); }
.status-contato_feito { background: #e0f2fe; color: #0369a1; }
.status-orcamento_enviado { background: #fef3c7; color: #92400e; }
.status-degustacao { background: var(--lime-200); color: var(--lime-800); }
.status-ganho { background: #bbf7d0; color: #166534; }
.status-perdido { background: #fee2e2; color: #b91c1c; }

.bar-novo { background: var(--stone-300); }
.bar-contato_feito { background: #7dd3fc; }
.bar-orcamento_enviado { background: #fcd34d; }
.bar-degustacao { background: var(--lime-300); }
.bar-ganho { background: #86efac; }
.bar-perdido { background: #fca5a5; }

/* ---- modal / drawer ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 40; }
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 18px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); width: 100%; max-width: 460px; padding: 24px; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 18px; font-weight: 700; margin: 0 0 16px; }

.drawer { position: fixed; top: 0; right: 0; height: 100%; width: 100%; max-width: 420px; background: #fff; box-shadow: -10px 0 30px rgba(0,0,0,0.15); z-index: 50; display: flex; flex-direction: column; }
.drawer.drawer-wide { max-width: 560px; }
.drawer-header { padding: 16px; border-bottom: 1px solid var(--stone-200); display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-header h3 { margin: 0; font-size: 17px; }
.drawer-sub { color: var(--stone-500); font-size: 13px; margin: 4px 0; }
.drawer-info { padding: 14px 16px; border-bottom: 1px solid var(--stone-100); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 13px; }
.drawer-info .full { grid-column: 1 / -1; }
.muted { color: var(--stone-400); }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 15px; color: var(--stone-500); }
.icon-btn:hover { color: var(--stone-800); }
.close-x { font-size: 22px; line-height: 1; }

.messages-list { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.msg-row { display: flex; }
.msg-row.out { justify-content: flex-end; }
.msg-row.in { justify-content: flex-start; }
.bubble { max-width: 80%; border-radius: 16px; padding: 8px 12px; font-size: 13px; }
.bubble.out { background: var(--lime-600); color: #fff; border-bottom-right-radius: 4px; }
.bubble.in { background: var(--stone-100); color: var(--stone-800); border-bottom-left-radius: 4px; }
.bubble-time { font-size: 10px; opacity: .7; margin: 4px 0 0; }

.send-form { padding: 10px; border-top: 1px solid var(--stone-200); display: flex; gap: 8px; }
.send-form input { flex: 1; border: 1px solid var(--stone-300); border-radius: 10px; padding: 9px 12px; }

.quick-task-box { padding: 10px 12px; border-top: 1px solid var(--stone-100); }
.quick-task-label { font-size: 11px; font-weight: 700; color: var(--stone-500); margin: 0 0 8px; letter-spacing: .04em; }
.quick-task-box form { display: flex; gap: 6px; }
.quick-task-box input[name=title] { flex: 1; }
.quick-task-box input, .quick-task-box select { border: 1px solid var(--stone-300); border-radius: 8px; padding: 6px 8px; font-size: 13px; }

/* ---- tasks ---- */
.task-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; background: #fff; border: 1px solid var(--stone-200); border-radius: 12px; padding: 12px; }
.task-form input[name=title] { flex: 1; min-width: 200px; }
.task-form input, .task-form select { border: 1px solid var(--stone-300); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.task-section-title { font-size: 13px; font-weight: 700; color: var(--stone-500); margin: 0 0 8px; }
.task-row { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--stone-200); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.task-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--lime-600); }
.task-row .grow { flex: 1; min-width: 0; }
.task-row .grow p { margin: 0; font-size: 14px; }
.task-row .grow p.done { text-decoration: line-through; color: var(--stone-400); }
.task-row .lead-tag { font-size: 12px; color: var(--stone-500); margin: 2px 0 0; }
.task-due { font-size: 12px; color: var(--stone-500); white-space: nowrap; }
.task-del { background: none; border: none; color: var(--stone-400); cursor: pointer; }
.task-del:hover { color: #dc2626; }
.empty-note { font-size: 13px; color: var(--stone-400); }

/* ---- dashboard ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--stone-200); border-radius: 14px; padding: 16px; }
.stat-label { font-size: 12px; color: var(--stone-500); margin: 0; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--lime-700); margin: 4px 0 0; }
.funnel-card { background: #fff; border: 1px solid var(--stone-200); border-radius: 14px; padding: 20px; max-width: 640px; }
.funnel-card h3 { margin: 0 0 12px; font-size: 15px; color: var(--stone-700); }
.funnel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.funnel-row .label { width: 150px; flex-shrink: 0; font-size: 13px; color: var(--stone-600); }
.funnel-track { flex: 1; background: var(--stone-100); border-radius: 999px; height: 16px; overflow: hidden; }
.funnel-fill { height: 16px; border-radius: 999px; }
.funnel-row .count { width: 30px; text-align: right; font-weight: 700; font-size: 13px; color: var(--stone-700); }
.notice-box { margin-top: 20px; max-width: 640px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px; padding: 14px; font-size: 13px; }

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .drawer-info { grid-template-columns: 1fr; }
}

/* Botão "Abrir no WhatsApp" (modo WhatsApp externo) */
.wa-open-btn { display:inline-block; margin-top:8px; padding:5px 10px; border-radius:8px; background:#25d366; color:#fff; font-size:12px; font-weight:600; text-decoration:none; }
.wa-open-btn:hover { background:#1fb855; }
.wa-open-btn-lg { font-size:13px; padding:6px 12px; margin-left:8px; }
.notes-log { white-space:pre-wrap; font-family:inherit; font-size:13px; color:var(--stone-500); margin:8px 0 0; }
