/* ── Reset & Variables ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f1a;
  --surface:   #141720;
  --surface2:  #1c2033;
  --surface3:  #232840;
  --border:    #2a3052;
  --border2:   #1e2440;
  --text:      #e2e8f0;
  --text-2:    #94a3b8;
  --text-3:    #64748b;
  --accent:    #6366f1;
  --accent-h:  #4f52d4;
  --green:     #10b981;
  --yellow:    #f59e0b;
  --red:       #ef4444;
  --purple:    #8b5cf6;
  --blue:      #3b82f6;
  --shadow:    0 1px 4px rgba(0,0,0,.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,.6);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.8);
  --radius:    10px;
  --radius-sm: 6px;
}

/* ── Light mode ──────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --surface2:  #f8fafc;
  --surface3:  #f1f5f9;
  --border:    #e2e8f0;
  --border2:   #edf2f7;
  --text:      #0f172a;
  --text-2:    #475569;
  --text-3:    #94a3b8;
  --shadow:    0 1px 4px rgba(0,0,0,.07);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.18);
}
/* Ajustes específicos para legibilidade no modo claro */
[data-theme="light"] .anotacao-sistema .anotacao-texto { color: #047857; }
[data-theme="light"] .agenda-info-box  { color: #065f46; border-color: rgba(16,185,129,.3); }
[data-theme="light"] .card-tab-btn.active { box-shadow: 0 1px 3px rgba(0,0,0,.15); }
[data-theme="light"] .kanban-col { box-shadow: 0 1px 4px rgba(0,0,0,.06); }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  font-weight: 800;
  font-size: 19px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -.3px;
}
.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-links a {
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: .15s;
}
.nav-links a:hover { background: var(--surface3); color: var(--text); }
.nav-links a.active { background: rgba(99,102,241,.15); color: var(--accent); }
.nav-user { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; }
.nav-user a { color: var(--text-3); text-decoration: none; transition: .15s; }
.nav-user a:hover { color: var(--text); }
.badge-perfil {
  font-size: 11px;
  background: rgba(99,102,241,.18);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.main-content { padding: 28px; max-width: 1500px; margin: 0 auto; }
/* Páginas com kanban usam toda a largura do monitor */
.main-content:has(.kanban-board) { max-width: none; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-actions { display: flex; gap: 8px; }
.btn-back { color: var(--accent); text-decoration: none; font-weight: 500; font-size: 13px; }
.btn-back:hover { text-decoration: underline; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: .15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--accent);  color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-secondary { background: var(--surface3); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-success   { background: var(--green);   color: #fff; border-color: var(--green); }
.btn-success:hover { opacity: .88; }
.btn-danger    { background: var(--red);     color: #fff; border-color: var(--red); }
.btn-block     { width: 100%; justify-content: center; }
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  transition: .15s;
  color: var(--text-2);
}
.btn-icon:hover { background: var(--surface3); color: var(--text); }
.btn-meet {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.btn-meet:hover { text-decoration: underline; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border2);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.card-head h2 { font-size: 20px; font-weight: 700; }

/* ── Tags ────────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.tag-origem   { background: rgba(139,92,246,.18);  color: #a78bfa; }
.tag-resp     { background: rgba(236,72,153,.15);   color: #f472b6; }
.tag-produto.nfe { background: rgba(59,130,246,.15); color: #60a5fa; }
.tag-produto.ege { background: rgba(16,185,129,.15); color: #34d399; }
.tag-pre      { background: rgba(139,92,246,.18);  color: #a78bfa; }
.tag-vend     { background: rgba(236,72,153,.15);   color: #f472b6; }
.tag-gerente  { background: rgba(245,158,11,.15);   color: #fbbf24; }
.tag-ativo    { background: rgba(16,185,129,.15);   color: #34d399; }
.tag-inativo  { background: rgba(239,68,68,.15);    color: #f87171; }

/* ── Status badge ────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

/* ── Kanban ──────────────────────────────────────────────────────────────── */
.kanban-board {
  display: grid;
  /* Todas as colunas em uma única linha, dividindo igualmente a largura disponível.
     Em telas estreitas, mantém min de 240px por coluna com scroll horizontal. */
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 16px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 200px;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border2);
}
.col-title { font-weight: 700; font-size: 13px; color: var(--text); }
.col-count {
  background: var(--surface3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.kanban-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}
.kanban-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: .15s;
  user-select: none;
}
.kanban-card:hover {
  border-color: var(--accent);
  background: var(--surface3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.kanban-card.dragging { opacity: .4; }
.card-name    { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.card-info    { font-size: 11px; color: var(--text-2); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta    { margin-bottom: 4px; }
.card-footer  { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.filtro-resp-select { background: var(--surface3); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer; min-width: 180px; }
.filtro-resp-select:focus { outline: none; border-color: var(--accent); }
.tag-blaster  { background: #92400e; color: #fcd34d; border: 1px solid #b45309; border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer; }
.tag-blaster:hover { background: #b45309; color: #fff; }
.btn-blaster  { display: inline-flex; align-items: center; gap: 4px; background: #92400e; color: #fcd34d; border: 1px solid #b45309; border-radius: 6px; padding: 4px 12px; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn-blaster:hover { background: #b45309; color: #fff; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 30% 40%, rgba(99,102,241,.08) 0%, transparent 60%),
                    radial-gradient(ellipse at 70% 60%, rgba(139,92,246,.06) 0%, transparent 60%);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
  color: var(--accent);
  letter-spacing: -.5px;
}
.login-sub {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  margin-bottom: 32px;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: .15s;
  background: var(--surface2);
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
select option { background: var(--surface2); color: var(--text); }
textarea { resize: vertical; }
input[type="color"] {
  padding: 2px 4px;
  height: 36px;
  cursor: pointer;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-error { background: rgba(239,68,68,.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
.alert-warn  { background: rgba(245,158,11,.1);  color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(2px); }
.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border2);
}
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-3);
  line-height: 1;
  transition: .15s;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--surface3); color: var(--text); }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border2);
}

/* ── Opportunity layout ──────────────────────────────────────────────────── */
.op-layout { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; align-items: start; }
.op-left, .op-right { display: flex; flex-direction: column; gap: 16px; }
.field-list { display: flex; flex-direction: column; gap: 12px; }
.field-row  { display: flex; align-items: center; gap: 12px; }
.field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  min-width: 90px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.field-val  { font-size: 13px; color: var(--text); }
.field-group { margin-top: 12px; }
.status-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.btn-status {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  background: var(--surface2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  transition: .15s;
}
.btn-status:hover { border-color: var(--accent); color: var(--accent); background: rgba(99,102,241,.08); }
.btn-status:disabled { opacity: .4; cursor: default; }

/* ── Agenda / Agendamentos ───────────────────────────────────────────────── */
.agenda-item {
  border-left: 3px solid var(--green);
  padding: 10px 14px;
  margin-top: 10px;
  background: rgba(16,185,129,.06);
  border-radius: 0 8px 8px 0;
}
.agenda-titulo { font-weight: 600; font-size: 13px; color: var(--text); }
.agenda-data   { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.agenda-info-box {
  background: rgba(16,185,129,.07);
  border: 1px solid rgba(16,185,129,.2);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0 8px;
  font-size: 13px;
  color: #34d399;
  line-height: 1.8;
}
.agenda-info-box p { margin: 0; }

/* ── Anotações ───────────────────────────────────────────────────────────── */
.anotacoes-lista { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.anotacao-item {
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  background: rgba(99,102,241,.06);
  border-radius: 0 8px 8px 0;
}
.anotacao-sistema {
  border-left-color: var(--green);
  background: rgba(16,185,129,.06);
}
.anotacao-sistema .anotacao-texto { color: #34d399; }
.anotacao-atividade {
  border-left-color: #f59e0b;
  background: rgba(245,158,11,.07);
}
.anotacao-atividade.concluida {
  border-left-color: #10b981;
  background: rgba(16,185,129,.05);
  opacity: .82;
}
.atividade-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap;
}
.atividade-badge {
  font-size: 11px; font-weight: 700; color: #f59e0b;
  background: rgba(245,158,11,.15); border-radius: 4px; padding: 2px 7px;
}
.atividade-horario {
  font-size: 12px; font-weight: 600; color: #fbbf24;
  background: rgba(245,158,11,.1); border-radius: 4px; padding: 2px 7px;
}
.btn-concluir-ativ {
  margin-left: auto; background: none; border: 1px solid #10b981; color: #10b981;
  border-radius: 4px; padding: 2px 9px; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn-concluir-ativ:hover  { background: #10b981; color: #fff; }
.btn-concluir-ativ:disabled { opacity: .45; cursor: default; }
/* ── Card tabs (oportunidade) ───────────────────────────────────────────────── */
.card-tabs { display: flex; gap: 2px; margin-bottom: 16px; background: var(--surface3); border-radius: var(--radius-sm); padding: 3px; }
.card-tab-btn { flex: 1; background: none; border: none; color: var(--text-2); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 4px; cursor: pointer; transition: .15s; text-align: center; }
.card-tab-btn:hover { color: var(--text); background: var(--border); }
.card-tab-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
/* ── Botão atividade ────────────────────────────────────────────────────────── */
.btn-atividade { background: #d97706; color: #fff; border: 1px solid #d97706; border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px; font-weight: 500; cursor: pointer; transition: .15s; }
.btn-atividade:hover { background: #b45309; border-color: #b45309; }
/* ── Badge atividade no card do kanban ─────────────────────────────────────── */
.card-atividade { font-size: 11px; font-weight: 600; color: #f59e0b; margin-bottom: 3px; }
/* ── Cores de atividade nos cards ──────────────────────────────────────────── */
.kanban-card.ativ-atrasada { border-left: 3px solid #ef4444; }
.kanban-card.ativ-hoje     { border-left: 3px solid #f59e0b; }
.kanban-card.ativ-futura   { border-left: 3px solid #3b82f6; }
/* ── Scroll sentinel ───────────────────────────────────────────────────────── */
.col-sentinel { height: 40px; display: flex; align-items: center; justify-content: center; }
.col-sentinel::after { content: ''; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* ── Qualificação ───────────────────────────────────────────────────────────── */
.btn-qualif { background: var(--surface3); color: #818cf8; border: 1px solid rgba(99,102,241,.4); border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px; font-weight: 500; cursor: pointer; transition: .15s; }
.btn-qualif:hover { background: rgba(99,102,241,.2); color: #fff; }
.btn-qual-opcao { width:100%; padding:12px 16px; border-radius:8px; border:2px solid transparent; cursor:pointer; font-size:13px; text-align:left; transition:.15s; background:var(--surface3); color:var(--text); }
.btn-qual-opcao:hover { opacity:.85; }
.btn-qual-quente { border-color:#ef4444; background:rgba(239,68,68,.08); }
.btn-qual-quente:hover { background:rgba(239,68,68,.18); }
.btn-qual-morno  { border-color:#f59e0b; background:rgba(245,158,11,.08); }
.btn-qual-morno:hover  { background:rgba(245,158,11,.18); }
.btn-qual-frio   { border-color:#3b82f6; background:rgba(59,130,246,.08); }
.btn-qual-frio:hover   { background:rgba(59,130,246,.18); }
/* ── Stats bar ──────────────────────────────────────────────────────────────── */
.kanban-stats { display:flex; gap:16px; flex-wrap:wrap; padding:8px 0 16px; }
.kstat { font-size:12px; color:var(--text-3); }
.kstat-val { font-size:16px; font-weight:700; color:var(--text); margin-right:3px; }
.kstat-ativo  .kstat-val { color:#10b981; }
.kstat-desc   .kstat-val { color:#64748b; }
.kstat-frio   .kstat-val { color:#3b82f6; }
.kstat-morno  .kstat-val { color:#f59e0b; }
.kstat-quente .kstat-val { color:#ef4444; }
.anotacao-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 5px;
}
.anotacao-meta strong { color: var(--text-2); }
.anotacao-texto { font-size: 13px; line-height: 1.65; color: var(--text); }
.empty-msg { color: var(--text-3); font-size: 13px; text-align: center; padding: 20px 0; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border2);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border2); font-size: 13px; color: var(--text); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface2); }

/* ── Nectar status ───────────────────────────────────────────────────────── */
.nectar-status-badge { margin-top: 6px; display: flex; align-items: center; gap: 6px; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border2);
  padding-bottom: 0;
  margin-bottom: 24px;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Regras Matrix ───────────────────────────────────────────────────────── */
.regras-matrix td, .regras-matrix th { border: 1px solid var(--border2); }
.regra-cell:hover { background: rgba(99,102,241,.08) !important; }
.regra-on  { background: rgba(16,185,129,.06); }
.regra-off { background: var(--surface2); }
.tag-mini {
  display: inline-block;
  background: var(--surface3);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10px;
  font-weight: 700;
  margin: 1px;
  color: var(--text-2);
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .kanban-board {
    grid-auto-flow: row;
    grid-auto-columns: unset;
    grid-template-columns: 1fr;
    overflow-x: visible;
  }
  .op-layout    { grid-template-columns: 1fr; }
  .form-row     { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
}
