@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --text-primary: #1a2340;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
}

header {
  background-color: #0f1e38;
  border-bottom: 1px solid #0a1628;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: 'Sora', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background-color: #00c2a0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.logo span {
  color: #00c2a0;
}

.badge-mod {
  background-color: rgba(0, 194, 160, 0.2);
  color: #00c2a0;
  border: 1px solid rgba(0, 194, 160, 0.3);
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-badge {
  font-size: 0.82rem;
  color: #a0b4cc;
}

.user-badge strong {
  color: #ffffff;
}

nav {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.nav-tab {
  padding: 14px 22px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  color: #00c2a0;
  border-bottom-color: #00c2a0;
}

.tab-dot {
  width: 7px;
  height: 7px;
  background-color: #00c2a0;
  border-radius: 50%;
  display: inline-block;
}

main {
  padding: 2rem;
  max-width: 1280px;
  margin: 0 auto;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.section-title {
  font-family: 'Sora', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  width: 3px;
  height: 18px;
  background-color: #00c2a0;
  border-radius: 2px;
  display: inline-block;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.teal { background-color: rgba(0, 194, 160, 0.12); }
.stat-icon.blue { background-color: rgba(26, 58, 110, 0.08); }
.stat-icon.warn { background-color: rgba(240, 160, 64, 0.12); }

.stat-val {
  font-family: 'Sora', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.rel-filtros-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .rel-filtros-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .rel-filtros-grid { grid-template-columns: 1fr; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input,
select,
textarea {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #00c2a0;
  background-color: var(--bg-card);
}

select option {
  background-color: var(--bg-card);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background-color: #00c2a0;
  color: #ffffff;
  font-weight: 600;
}

.btn-primary:hover {
  background-color: #009d82;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: #00c2a0;
}

.btn-danger {
  background-color: transparent;
  border: 1px solid rgba(224, 85, 85, 0.3);
  color: #e05555;
  font-size: 0.8rem;
  padding: 6px 12px;
}

.btn-danger:hover {
  background-color: rgba(224, 85, 85, 0.08);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.82rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 13px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

tr:hover td {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

td strong {
  color: var(--text-primary);
  font-weight: 500;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 500;
}

.chip-teal { background-color: rgba(0, 194, 160, 0.12); color: #007a64; }
.chip-warn { background-color: rgba(240, 160, 64, 0.12); color: #b45309; }
.chip-danger { background-color: rgba(224, 85, 85, 0.12); color: #c0392b; }
.chip-blue { background-color: rgba(26, 58, 110, 0.08); color: #1e40af; }

.agenda-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.visit-item {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-left: 3px solid #00c2a0;
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.visit-time {
  font-family: 'Sora', sans-serif;
  font-size: 0.8rem;
  color: #00a085;
  font-weight: 600;
  margin-bottom: 4px;
}

.visit-company {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
}

.visit-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background-color: var(--bg-card);
  border: 1px solid #33373d;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  padding: 2rem;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.avatar {
  width: 36px;
  height: 36px;
  background-color: rgba(0, 194, 160, 0.12);
  border: 1px solid rgba(0, 194, 160, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #007a64;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
}

#toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-16 { margin-bottom: 1rem; }
.mb-24 { margin-bottom: 1.5rem; }
.mt-16 { margin-top: 1rem; }
.text-sm { font-size: 0.82rem; color: var(--text-secondary); }

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .agenda-grid { grid-template-columns: 1fr; }
  main { padding: 1rem; }
  nav { overflow-x: auto; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ===========================
   NOVOS ESTILOS — v2
   =========================== */

/* Cards clicáveis */
.stat-icon.purple { background-color: rgba(139,92,246,0.12); }
.stat-icon.orange { background-color: rgba(249,115,22,0.12); }

.stat-card-clickable {
  cursor: pointer;
  position: relative;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  border: 1px solid var(--border-color);
}
.stat-card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  border-color: #00c2a0;
}
.stat-click-hint {
  position: absolute;
  bottom: 10px; right: 14px;
  font-size: 0.7rem;
  color: #00c2a0;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s;
}
.stat-card-clickable:hover .stat-click-hint { opacity: 1; }

/* Modal tamanhos */
.modal-lg { max-width: 680px; }
.modal-xl { max-width: 900px; }

/* ===== CALENDÁRIO SEMANAL ===== */
.cal-semana-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.cal-dia {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 8px;
  min-height: 110px;
  position: relative;
}
.cal-dia-nome {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 4px;
}
.cal-dia-num {
  font-family: 'Sora', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  line-height: 1;
}
.cal-hoje {
  background: rgba(0,194,160,0.07);
  border-color: #00c2a0;
}
.cal-hoje .cal-dia-num { color: #00a085; }
.cal-tem-visita { border-color: #3b82f6; }
.cal-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: #3b82f6;
  color: #fff;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
}
.cal-visitas-lista { margin-top: 8px; }
.cal-visita-item {
  font-size: 0.72rem;
  padding: 4px 6px;
  border-radius: 5px;
  margin-bottom: 4px;
  color: var(--text-primary);
  line-height: 1.3;
}
.cal-status-agendada { background: rgba(59,130,246,0.1); border-left: 2px solid #3b82f6; }
.cal-status-realizada { background: rgba(0,194,160,0.1); border-left: 2px solid #00c2a0; }
.cal-status-cancelada { background: rgba(224,85,85,0.1); border-left: 2px solid #e05555; }

/* ===== CALENDÁRIO MENSAL ===== */
.cal-mes-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-mes-header {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 6px 0;
}
.cal-mes-cell {
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  padding: 8px 6px;
  min-height: 58px;
  position: relative;
  cursor: default;
  transition: background 0.15s;
}
.cal-mes-cell:hover { background: var(--bg-subtle); }
.cal-mes-vazio { border-color: transparent; background: transparent; }
.cal-mes-num {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.cal-mes-hoje {
  background: rgba(0,194,160,0.08);
  border-color: #00c2a0;
}
.cal-mes-hoje .cal-mes-num { color: #00a085; font-weight: 700; }
.cal-mes-com-visita { background: rgba(59,130,246,0.05); }
.cal-mes-dots { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }
.cal-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.cal-dot-blue { background: #3b82f6; }
.cal-dot-green { background: #00c2a0; }
.cal-mes-count {
  position: absolute;
  top: 5px; right: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #3b82f6;
}
.cal-legenda {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  align-items: center;
  flex-wrap: wrap;
}
.cal-legenda span { display: flex; align-items: center; gap: 5px; }
.cal-hoje-legend { color: #00a085; font-weight: 600; }

/* ===== RDO ===== */
.rdo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.rdo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.rdo-titulo {
  font-family: 'Sora', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.rdo-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 3px;
}
.rdo-secao {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-radius: 8px;
}
.rdo-secao strong { font-size: 0.78rem; color: var(--text-secondary); display: block; margin-bottom: 4px; }
.rdo-secao p { font-size: 0.88rem; color: var(--text-primary); line-height: 1.5; white-space: pre-wrap; }
.rdo-footer { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ===== RELATÓRIO ===== */
.rel-header-info { margin-bottom: 1.5rem; }
.rel-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.rel-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.1rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.rel-stat-val {
  font-family: 'Sora', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.rel-stat-label { font-size: 0.74rem; color: var(--text-secondary); margin-top: 6px; }
.rel-stat-green .rel-stat-val { color: #007a64; }
.rel-stat-blue .rel-stat-val { color: #1e40af; }
.rel-stat-red .rel-stat-val { color: #c0392b; }
.rel-stat-purple .rel-stat-val { color: #7c3aed; }
.rel-stat-orange .rel-stat-val { color: #b45309; }
.rel-resultados { display: flex; flex-direction: column; gap: 10px; }
.rel-resultado-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-radius: 8px;
}

/* Filtros RDO */
.flex-wrap { flex-wrap: wrap; }

@media (max-width: 700px) {
  .cal-semana-grid { grid-template-columns: repeat(2, 1fr); }
  .cal-mes-grid { gap: 2px; }
  .rel-stats-row { grid-template-columns: repeat(2,1fr); }
}

/* ====================================================
   TAGS (@arroba e ###destaque###)
   ==================================================== */
.tag-arroba {
  display: inline-block;
  background: #ede9fe;
  color: #6d28d9;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tag-destaque {
  background: #fef9c3;
  color: #92400e;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 600;
  font-size: 0.85rem;
  border-left: 3px solid #f59e0b;
}
.tag-produto-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border-radius: 8px;
  padding: 6px 12px;
}
.tag-produto-count {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
  min-width: 18px;
  text-align: right;
}

/* ====================================================
   POPUP VISITA
   ==================================================== */
.popup-info-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
  color: var(--text-primary);
}
.popup-info-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 110px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.popup-obs-box {
  background: var(--bg-subtle);
  border-left: 3px solid #00c2a0;
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
}
.visit-item-destaque {
  border-left: 3px solid #f59e0b !important;
  background: #fffbeb !important;
}
.obs-preview {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ====================================================
   TELA DE LOGIN / CADASTRO
==================================================== */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f1e38 0%, #142b4f 100%);
  padding: 20px;
}

.auth-box {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Sora', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-logo .logo-icon {
  width: 30px;
  height: 30px;
  font-size: 0.9rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-subtle);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 22px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-form label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 12px;
  margin-bottom: 4px;
}

.auth-form input {
  padding: 11px 13px;
  border: 1.5px solid var(--border-color);
  border-radius: 9px;
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color .2s;
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.auth-form input:focus {
  border-color: #00c2a0;
  background: var(--bg-card);
}

.btn-auth {
  margin-top: 20px;
  background: linear-gradient(135deg, #00c2a0, #00a989);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 12px 0;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
}

.btn-auth:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.auth-error {
  min-height: 18px;
  color: #e05555;
  font-size: 0.8rem;
  margin-top: 10px;
  text-align: center;
}

.btn-logout {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 14px;
  transition: background .2s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.2);
}

.header-right {
  display: flex;
  align-items: center;
}

/* ====================================================
   SUB-ABAS (Contatos: Contas / Clientes)
==================================================== */
.subtabs {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 5px;
  border-radius: 10px;
  width: fit-content;
}

.subtab {
  padding: 9px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 7px;
  transition: all 0.2s;
  user-select: none;
}

.subtab:hover {
  color: var(--text-primary);
}

.subtab.active {
  background: var(--bg-card);
  color: #00c2a0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ====================================================
   FUNIL DE VENDAS — KANBAN
==================================================== */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}

.kanban-col {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  min-width: 260px;
  flex: 1 0 260px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
}

.kanban-col.drag-over {
  background: #e6fbf6;
  border-color: #00c2a0;
}

.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: inherit;
  border-radius: 12px 12px 0 0;
}

.kanban-col-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-col-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--border-color);
  border-radius: 999px;
  padding: 2px 9px;
}

.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
}

.kanban-col-add {
  padding: 8px 14px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #00c2a0;
  cursor: pointer;
  user-select: none;
}
.kanban-col-add:hover { text-decoration: underline; }

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 13px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.15s, transform 0.15s;
}

.kanban-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.09);
}

.kanban-card.dragging {
  opacity: 0.4;
}

.kanban-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.kanban-card-conta {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.kanban-card-valor {
  font-weight: 700;
  color: #00c2a0;
}

.kanban-empty {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
  padding: 14px 4px;
}

/* ====================================================
   FUNIL — ESTATÍSTICAS (tempo médio de venda)
==================================================== */
.funil-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.funil-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 20px;
  min-width: 160px;
}

.funil-stat-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
}

.funil-stat-label {
  font-size: 0.74rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 2px;
}

/* ====================================================
   FUNIL — CARD COM AVISO DE ATENÇÃO
==================================================== */
.kanban-card-atencao {
  border-left: 3px solid #e05555;
  background: #fff8f8;
}

.kanban-card-atencao-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.kanban-card-tarefas {
  font-size: 0.72rem;
  color: #8b5cf6;
  font-weight: 600;
}

.kanban-card-dias {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

/* ====================================================
   LISTA DE TAREFAS (dentro da oportunidade)
==================================================== */
.tarefa-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--bg-subtle);
}

.tarefa-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}

.tarefa-texto {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.tarefa-item.feita {
  background: #f0fdfa;
  border-color: #ccfbf1;
}

.tarefa-item.feita .tarefa-texto {
  text-decoration: line-through;
  color: var(--text-muted);
}

.tarefa-excluir {
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.tarefa-excluir:hover {
  color: #e05555;
}

/* ====================================================
   BADGE DE TIPO DE CONTA (header)
==================================================== */
.user-badge-tipo {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(0, 194, 160, 0.15);
  color: #00c2a0;
  padding: 2px 9px;
  border-radius: 999px;
}

/* ====================================================
   FUNIL — TOGGLE EXTERNO / INTERNO
==================================================== */
.funil-toggle {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 5px;
  border-radius: 10px;
  width: fit-content;
  margin-bottom: 16px;
}

.funil-toggle-btn {
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  border-radius: 7px;
  transition: all 0.2s;
}

.funil-toggle-btn:hover {
  color: var(--text-primary);
}

.funil-toggle-btn.active {
  background: var(--bg-card);
  color: #00c2a0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}


/* ============================================================
   TEMA ESCURO (alternado pelo botão no cabeçalho)
   Como quase todo o site usa as variáveis acima, só precisamos
   redefinir as variáveis aqui — o resto se ajusta sozinho.
   ============================================================ */
body.tema-escuro {
  --bg-body: #12141c;
  --bg-card: #1a1d29;
  --bg-subtle: #232734;
  --text-primary: #eef1f7;
  --text-secondary: #aab2c5;
  --text-muted: #7c869c;
  --border-color: #2f3448;
}

/* Casos especiais: destaques coloridos que não usam as variáveis
   (fundo colorido de aviso/atenção), precisam de versão própria pro escuro */
body.tema-escuro .kanban-card-atencao {
  background: #2a1c1c;
  border-left-color: #e05555;
}

body.tema-escuro .visit-item-destaque {
  background: #2a2410 !important;
  border-left-color: #f59e0b !important;
}

body.tema-escuro tr:hover td {
  background-color: #20232f;
}

body.tema-escuro input,
body.tema-escuro select,
body.tema-escuro textarea {
  background-color: var(--bg-body);
  border-color: var(--border-color);
  color: var(--text-primary);
}
body.tema-escuro input::placeholder,
body.tema-escuro textarea::placeholder {
  color: var(--text-muted);
}

body.tema-escuro .btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-color);
}
body.tema-escuro .btn-secondary:hover {
  background-color: var(--border-color);
}

body.tema-escuro .modal-overlay {
  background-color: rgba(0,0,0,0.7);
}

body.tema-escuro .kanban-card:hover {
  border-color: #3a4159;
}

/* Banner de aviso de produtos duplicados no Estoque */
.aviso-duplicata {
  background: #fef9c3;
  border: 1px solid #eab308;
  color: #854d0e;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  margin-bottom: 20px;
}
body.tema-escuro .aviso-duplicata {
  background: #3a3410;
  border-color: #a16207;
  color: #fde68a;
}

/* Destaque de linhas/itens duplicados no Estoque (categoria repetida ou produto com mesmo código+marca) */
.linha-duplicada {
  background: #fef9c3 !important;
}
body.tema-escuro .linha-duplicada {
  background: #3a3410 !important;
}
