* { box-sizing: border-box; }

:root {
  --black: #0a0a0a;
  --white: #ffffff;
  --line: #e0e0e0;
  --muted: #6b6b6b;
  --danger: #c0392b;
  --radius: 6px;
  --container: 560px;
}

body {
  font-family: 'Inter', -apple-system, Arial, sans-serif;
  font-weight: 300;
  background: #fafafa;
  margin: 0;
  color: var(--black);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.site-header {
  background: var(--white);
  padding: 1.4rem 1.2rem;
  text-align: center;
  border-bottom: 1px solid var(--line);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-header .logo { height: 50px; }

.sair-link {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color 0.15s, border-color 0.15s;
}
.sair-link:hover { color: var(--black); border-color: var(--black); }

.espelho-banner {
  position: sticky;
  top: 0;
  z-index: 700;
  background: #fff4de;
  border-bottom: 1px solid #e6c377;
  color: #6b4c07;
  padding: 0.65rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  font-size: 0.85rem;
}
.espelho-banner[hidden] { display: none; }
.espelho-banner strong { color: #4a3204; }
.espelho-sair-btn { flex-shrink: 0; white-space: nowrap; border-color: #6b4c07; color: #6b4c07; }
.espelho-sair-btn:hover { background: #6b4c07; color: #fff4de; }

main.container {
  max-width: var(--container);
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1rem 3rem;
}

img, video, canvas, svg { max-width: 100%; }

h1, h2, h3 { font-family: 'Playfair Display', serif; font-weight: 700; color: var(--black); }

.page-title { font-size: 1.5rem; margin: 0 0 1.2rem; text-align: center; }

.panel-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.3rem;
  margin: 0 0 1.2rem;
}

.auth-card { margin-top: 1.5rem; }

label {
  display: block;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  margin: 0.9rem 0 0.35rem;
  font-size: 0.98rem;
  color: var(--black);
}
label:first-of-type { margin-top: 0; }

input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  color: var(--black);
  background: var(--white);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--black);
}

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

.fixed-value {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5f5f5;
  color: var(--black);
  font-size: 1rem;
}

.hint { color: var(--muted); font-size: 0.88rem; margin: 0.2rem 0 1rem; text-align: center; }

.alert-error {
  background: #fdf0f0;
  border: 1px solid #e0b4b4;
  color: var(--danger);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: #f0f7f0;
  border: 1px solid #b9dab9;
  color: #256029;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--black);
  background: transparent;
  color: var(--black);
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--black); color: var(--white); }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: #2a2a2a; }
.btn-outline { background: transparent; color: var(--black); }
.btn-small { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; margin-top: 1.4rem; }
.btn:disabled { background: #bbb; border-color: #bbb; color: #fff; cursor: not-allowed; }

.footer-link { text-align: center; margin-top: 1.4rem; }
.footer-link a { color: var(--muted); font-size: 0.82rem; text-decoration: none; }
.footer-link a:hover { color: var(--black); }

.tabnav {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}
.tabnav a {
  padding: 0.6rem 0.2rem;
  margin-right: 1rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  border-bottom: 2px solid transparent;
}
.tabnav a.active, .tabnav a:hover { color: var(--black); border-bottom-color: var(--black); }

.tabnav-scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 1px;
}
.tabnav-scroll a {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.7rem 0.3rem;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.tabnav-scroll::-webkit-scrollbar { height: 3px; }
.tabnav-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.list { display: flex; flex-direction: column; gap: 0.6rem; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row-title { font-weight: 500; }
.list-row-sub { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.8rem;
  margin-top: 0.4rem;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  margin: 0;
}
.checkbox-item input { width: auto; }

.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.radio-item, .checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 0.95rem;
}
.radio-item input, .checkbox-line input { width: auto; }
.checkbox-line.disabled { opacity: 0.45; }

.export-panel .export-fields { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: flex-end; }
.export-panel label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted); gap: 0.3rem; font-family: 'Inter', sans-serif; font-weight: 400; margin: 0; }
.export-panel input, .export-panel select { padding: 0.5rem; font-size: 0.9rem; }

.loteamento h2 { border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; font-size: 1.05rem; }
.count { background: var(--black); color: var(--white); border-radius: 999px; padding: 0.1rem 0.6rem; font-size: 0.78rem; font-family: 'Inter', sans-serif; }
section.loteamento { margin-bottom: 1.8rem; }

.lead-card { position: relative; padding: 1rem; }
.card-header { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.5rem; flex-wrap: wrap; gap: 0.3rem; padding-right: 4rem; }
.corretor { font-weight: 600; color: var(--black); }
.texto { margin: 0.4rem 0; line-height: 1.45; font-size: 0.94rem; }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0; }
.badge { background: #f2f2f2; color: #444; font-size: 0.74rem; padding: 0.2rem 0.55rem; border-radius: 999px; font-family: 'Inter', sans-serif; }
.audio-block { margin-top: 0.6rem; }
.audio-block audio { width: 100%; }
.transcricao { font-size: 0.88rem; color: #333; background: #f7f7f7; padding: 0.6rem; border-radius: 6px; margin-top: 0.5rem; }
.transcricao-pendente { font-size: 0.83rem; color: #999; font-style: italic; }
.vazio { color: #999; font-style: italic; font-size: 0.9rem; }

.btn-excluir {
  position: absolute; top: 0.7rem; right: 0.7rem;
  background: transparent; border: 1px solid #e0b4b4; color: var(--danger);
  font-size: 0.72rem; padding: 0.15rem 0.5rem; border-radius: 999px; cursor: pointer; opacity: 0.75;
}
.btn-excluir:hover { opacity: 1; background: #fdf0f0; }

.audio-controls { display: flex; gap: 0.6rem; margin-top: 0.5rem; flex-wrap: wrap; }
.btn-record { flex: 1; min-width: 120px; }
.btn-record.recording { background: var(--danger); color: var(--white); border-color: var(--danger); animation: pulse-border 1.2s infinite; }
.btn-stop { flex: 1; min-width: 120px; }
.btn-delete { color: var(--danger); border-color: var(--danger); }
.btn-audio-remove { display: none; }
#recordStatus { font-size: 0.85rem; color: var(--muted); margin-top: 0.4rem; min-height: 1.1rem; }
.recording-indicator { display: none; align-items: center; gap: 0.5rem; margin-top: 0.6rem; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: pulse-dot 1.2s infinite; flex-shrink: 0; }
.rec-text { color: var(--danger); font-weight: 500; font-size: 0.95rem; }
@keyframes pulse-dot { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(1.4); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pulse-border { 0% { box-shadow: 0 0 0 0 rgba(192,57,43,0.5); } 70% { box-shadow: 0 0 0 8px rgba(192,57,43,0); } 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0); } }
audio.preview { width: 100%; margin-top: 0.6rem; display: none; }

.whatsapp-help { text-align: center; margin-top: 2.2rem; }
.whatsapp-help a { display: inline-block; background: var(--white); border: 1px solid var(--line); color: #666; font-family: 'Inter', sans-serif; font-size: 0.8rem; padding: 8px 16px; border-radius: var(--radius); text-decoration: none; }

/* ---------- CRM: pilulas de estagio ---------- */
.pill {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
}
.pill-novo { background: #eef0f2; color: #444; border-color: #d8dade; }
.pill-contato { background: #eaf1fb; color: #1c5fa8; border-color: #cfe0f5; }
.pill-visitou { background: #f3ecfb; color: #6a3fb5; border-color: #e1d3f5; }
.pill-negociando { background: #fdf3e0; color: #a3690a; border-color: #f6e0b4; }
.pill-fechado { background: #eaf7ec; color: #256029; border-color: #cbe9cf; }
.pill-perdido { background: #fdf0f0; color: #c0392b; border-color: #f2d0cd; }

.badge-vencido { background: #fdf0f0; color: var(--danger); border: 1px solid #e0b4b4; }

/* ---------- CRM: distribuir leads sem atividade (histórico expandível + ações do card) ---------- */
.detalhe-toggle { margin-top: 0.7rem; border-top: 1px solid var(--line); padding-top: 0.6rem; }
.detalhe-toggle summary {
  cursor: pointer;
  list-style: none;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--black);
}
.detalhe-toggle summary::-webkit-details-marker { display: none; }
.detalhe-toggle summary::before { content: '▸ '; }
.detalhe-toggle[open] summary::before { content: '▾ '; }
.timeline-item { border-top: 1px solid var(--line); padding-top: 0.6rem; margin-top: 0.6rem; }
.timeline-item:first-child { border-top: none; margin-top: 0.5rem; padding-top: 0; }
.acoes-distribuir { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; align-items: stretch; }
.acoes-distribuir form { display: flex; gap: 0.5rem; flex: 1 1 220px; min-width: 220px; }
.acoes-distribuir select { flex: 1; min-width: 0; }
.acoes-distribuir .btn { flex-shrink: 0; }

/* ---------- CRM: lista de fichas ---------- */
.lista-top { margin-bottom: 1rem; }
.btn-aba-principal { margin-bottom: 1.4rem; }
.filtro-estagio-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.filtro-estagio-row label { margin: 0; font-size: 0.85rem; }
.filtro-estagio-row select { width: auto; flex: 1; padding: 8px; }

.ficha-row { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.ficha-row:hover { border-color: var(--black); }
.ficha-row.vencido { border-color: var(--danger); background: #fffaf9; }

.ficha-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.ficha-actions .btn { min-height: 40px; }

.footer-back { border: none; background: transparent; padding: 0.4rem 0; margin-bottom: 0.6rem; color: var(--muted); font-size: 0.9rem; }
.footer-back:hover { background: transparent; color: var(--black); }

.retorno-row { display: flex; gap: 0.6rem; margin-top: 0.4rem; flex-wrap: wrap; }
.retorno-row input[type="date"] { flex: 0 0 160px; }
.retorno-row input[type="text"] { flex: 1; min-width: 150px; }
.retorno-botoes { display: flex; gap: 0.6rem; margin-top: 0.6rem; }
.retorno-botoes .btn { flex: 1; }

#detalheAcoes label:first-of-type { margin-top: 0.9rem; }

/* ---------- CRM: selos de retorno ---------- */
.selo {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: 'Inter', sans-serif;
}
.selo-atrasado { background: #fdf0f0; color: var(--danger); border-color: #e0b4b4; }
.selo-hoje { background: #fdf3e0; color: #a3690a; border-color: #f6e0b4; }
.selo-em-dia { background: #eef0f2; color: #444; border-color: #d8dade; }

/* ---------- CRM: aba Retornos ---------- */
.retorno-item { padding: 1rem; }
.retorno-data-destaque {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

/* ---------- CRM: aba Visão geral ---------- */
.kpi-row { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.kpi-tile {
  flex: 1 1 100px;
  min-width: 100px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 0.6rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.kpi-valor {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1;
}
.kpi-label { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }

.bar-chart { display: flex; flex-direction: column; gap: 0.5rem; }
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.5rem 0.4rem;
  border-radius: var(--radius);
  min-height: 44px;
  transition: background 0.15s;
}
.bar-row:hover, .bar-row:active { background: #f2f2f2; }
.bar-label {
  flex: 0 0 82px;
  font-size: 0.78rem;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  flex: 1;
  min-width: 0;
  background: #eef0f2;
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.25s; }
.fill-novo { background: #9aa1ab; }
.fill-contato { background: #3a7bc8; }
.fill-visitou { background: #8a5cd6; }
.fill-negociando { background: #d99a2b; }
.fill-fechado { background: #3f9a4c; }
.fill-perdido { background: #c0392b; }
.bar-valor { flex: 0 0 26px; text-align: right; font-size: 0.82rem; font-weight: 500; }

/* ---------- Gestor: navegação com permissões ---------- */
.tabnav-scroll .locked {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.7rem 0.3rem;
  margin-right: 1rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: #bbb;
  font-size: 0.92rem;
  cursor: not-allowed;
}
.nav-badge {
  font-size: 0.6rem;
  font-weight: 600;
  background: var(--black);
  color: var(--white);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 5px;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.locked .nav-badge { background: #bbb; }

/* ---------- Gestor: permissões (switches) ---------- */
.group-head {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 1.4rem 0 0.2rem;
}
.group-head:first-of-type { margin-top: 0; }

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.toggle-row:last-of-type { border-bottom: none; }
.toggle-text { display: flex; flex-direction: column; gap: 0.15rem; }
.t-name { font-family: 'Inter', sans-serif; font-weight: 500; font-size: 0.95rem; color: var(--black); }
.t-desc { font-size: 0.78rem; color: var(--muted); font-weight: 300; line-height: 1.35; }

.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-visual {
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  border-radius: 20px;
  background: #d0d0d0;
  position: relative;
  transition: background 0.15s;
}
.switch-visual::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  transition: left 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.switch-input:checked + .switch-visual { background: var(--black); }
.switch-input:checked + .switch-visual::after { left: 21px; }
.switch-input:focus-visible + .switch-visual { outline: 2px solid var(--black); outline-offset: 2px; }

/* ---------- Gestor: seletor de período ---------- */
.period { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.period .p {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  min-height: 36px;
}
.period .p.on { background: var(--black); color: var(--white); border-color: var(--black); }
.period-custom { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.period-custom label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}
.period-custom input[type="date"] { padding: 0.5rem; font-size: 0.85rem; }

.filtros-gestor { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.9rem; }
.filtros-gestor select { flex: 1; min-width: 140px; padding: 0.55rem; font-size: 0.85rem; }

/* ---------- Gestor: KPIs sensíveis ---------- */
.kpi-sens { position: relative; }
.sens-tag {
  display: inline-block;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #a3690a;
  background: #fff8e6;
  border: 1px solid #f0e2b8;
  border-radius: 4px;
  padding: 1px 6px;
  vertical-align: middle;
  margin-left: 0.3rem;
}
.kpi-sens .sens-tag { position: absolute; top: 0.7rem; right: 0.7rem; margin-left: 0; }
.kpi-bloqueado { justify-content: center; align-items: center; }
.kpi-bloqueado .kpi-label { text-align: center; opacity: 0.7; }
.kpi-alerta { color: var(--danger) !important; }
.fill-arquivado { background: #999; }

/* ---------- Gestor: tabela de desempenho ---------- */
.table-scroll { overflow-x: auto; margin-bottom: 0.5rem; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th {
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th a { color: inherit; text-decoration: none; }
th a.th-ativo, th a:hover { color: var(--black); }
td { padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--line-soft, var(--line)); font-size: 0.85rem; }
td.name { font-family: 'Playfair Display', serif; font-weight: 600; font-size: 0.92rem; }
.mini { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
.late { color: var(--danger); font-weight: 600; }
.emp { font-size: 0.72rem; color: #444; background: #f2f2f2; padding: 0.15rem 0.55rem; border-radius: 999px; font-family: 'Inter', sans-serif; }

/* ---------- Gestor: gráfico de barras largo (Origem) ---------- */
.bar-chart-largo .bar-label { flex-basis: 150px; white-space: normal; line-height: 1.2; }

/* ---------- Tutorial embutido (corretor) ---------- */
.tut-footer { margin-top: 1.4rem; }
.tut-footer-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; }
.tut-btn-ic {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--black); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-weight: 700; font-size: 0.75rem; flex-shrink: 0;
}
.tut-pulse-dot {
  position: absolute; top: -5px; right: 16px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 0 rgba(192,57,43,.5); animation: tutPulse 1.6s infinite;
}
@keyframes tutPulse {
  0% { box-shadow: 0 0 0 0 rgba(192,57,43,.5); }
  70% { box-shadow: 0 0 0 10px rgba(192,57,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(192,57,43,0); }
}

.tut-toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom));
  max-width: 380px; margin: 0 auto; background: var(--black); color: var(--white);
  border-radius: 14px; padding: 16px 18px; box-shadow: 0 12px 30px rgba(0,0,0,.28); z-index: 500;
}
.tut-toast h4 { font-family: 'Playfair Display', serif; color: #fff; font-size: 1.05rem; margin: 0 0 6px; }
.tut-toast p { font-size: 0.86rem; color: #e6e6e6; font-weight: 300; margin: 0 0 14px; line-height: 1.45; }
.tut-toast-acts { display: flex; gap: 10px; }
.tut-toast-acts button {
  flex: 1; padding: 11px; border-radius: 8px; font-size: 0.86rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; font-family: 'Inter', sans-serif; min-height: 44px;
}
.tut-toast-acts .tut-primary { background: #fff; color: var(--black); }
.tut-toast-acts .tut-ghost { background: transparent; border-color: #555; color: #ddd; }

.tut-overlay {
  position: fixed; inset: 0; background: #fff; z-index: 1000;
  display: flex; flex-direction: column;
}
.tut-overlay[hidden] { display: none; }
.tut-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 4px; flex: 0 0 auto; }
.tut-step-count { font-size: 0.7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tut-close { font-size: 0.85rem; color: var(--muted); cursor: pointer; background: none; border: none; padding: 8px; font-family: 'Inter', sans-serif; min-height: 44px; }
.tut-close:hover { color: var(--black); }
.tut-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 18px 4px; }
.tut-illo-box {
  border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #fafafa;
  min-height: 210px; display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  margin-bottom: 16px; overflow: hidden;
}
.tut-illo-box > div { width: 100%; max-width: 100%; flex: 0 0 auto; }
.tut-tag { font-size: 0.7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 6px; }
.tut-title { font-family: 'Playfair Display', serif; font-size: 1.3rem; font-weight: 700; margin: 0 0 8px; line-height: 1.2; }
.tut-text { font-size: 0.92rem; color: #555; font-weight: 300; margin: 0; line-height: 1.5; }
.tut-nav {
  flex: 0 0 auto; display: flex; gap: 10px; align-items: center;
  padding: 14px 18px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
.tut-final-nav { flex-direction: column; }
.tut-dots { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.tut-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tut-dot.on { background: var(--black); width: 18px; border-radius: 4px; }
.tut-btn2 {
  font-size: 0.9rem; font-weight: 600; padding: 12px 18px; border-radius: 8px;
  border: 1px solid var(--black); cursor: pointer; min-height: 44px; font-family: 'Inter', sans-serif;
}
.tut-btn2.solid { background: var(--black); color: #fff; }
.tut-btn2.ghost { background: #fff; color: var(--black); }
.tut-final-nav .tut-btn2 { width: 100%; }

.tut-mini-tabs { display: flex; gap: 10px; font-size: 0.72rem; color: #bbb; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px; }
.tut-mini-tabs .hi { color: var(--black); font-weight: 700; border-bottom: 2px solid var(--black); padding-bottom: 8px; margin-bottom: -9px; }
.tut-mock { pointer-events: none; cursor: default; }
.tut-mock:hover { border-color: var(--line); }
.tut-hl.tut-mock { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192,57,43,.12); }

.tut-ba-step { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.tut-ba-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--black); color: #fff;
  font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.tut-ba-panel { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.tut-ba-cap { font-size: 0.75rem; color: #555; margin-bottom: 6px; font-weight: 500; }
.tut-ba-arrow { text-align: center; font-size: 20px; color: var(--danger); margin: 2px 0; line-height: 1; }

.tut-point-wrap { position: relative; padding-top: 40px; text-align: center; }
.tut-tap-label {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  background: var(--danger); color: #fff; font-size: 0.75rem; font-weight: 600;
  padding: 4px 12px; border-radius: 20px; white-space: nowrap;
}
.tut-arrow-bob { position: absolute; font-size: 26px; color: var(--danger); top: 24px; left: 50%; transform: translateX(-50%); animation: tutBob 1.1s infinite; line-height: 1; }
@keyframes tutBob { 50% { transform: translateX(-50%) translateY(-6px); } }
.tut-big-btn { background: var(--black); color: #fff; border-radius: 8px; padding: 13px; text-align: center; font-size: 0.95rem; font-weight: 600; }
.tut-field-mock { border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 0.88rem; color: var(--muted); background: #fff; margin-top: 12px; }

.tut-mic {
  width: 58px; height: 58px; border-radius: 50%; background: var(--danger); margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px;
}
.tut-rec { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 0.85rem; color: var(--danger); font-weight: 600; }
.tut-rec .d { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: tutBlink 1s infinite; }
@keyframes tutBlink { 50% { opacity: .3; } }
.tut-center { text-align: center; }

.tut-map-zone { border: 1.5px solid var(--black); border-radius: 11px; padding: 12px 13px; background: #fff; margin-bottom: 10px; }
.tut-map-zone.soft { border-color: var(--line); border-width: 1px; }
.tut-map-zone:last-child { margin-bottom: 0; }
.tut-z-label { font-size: 0.68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.tut-map-tab { display: flex; align-items: flex-start; gap: 9px; padding: 5px 0; }
.tut-map-tab .emoji { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.tut-map-tab .mt-name { font-size: 0.85rem; font-weight: 600; }
.tut-map-tab .mt-desc { font-size: 0.76rem; color: #666; font-weight: 300; }
.tut-map-btn { background: var(--black); color: #fff; border-radius: 7px; padding: 9px; text-align: center; font-size: 0.82rem; font-weight: 600; }
.tut-map-help { border: 1px solid var(--line); border-radius: 7px; padding: 9px; text-align: center; font-size: 0.78rem; color: #666; }

.tut-bars-mini { display: flex; flex-direction: column; gap: 7px; }
.tut-bmini { display: flex; align-items: center; gap: 8px; }
.tut-bmini .bl { font-size: 0.72rem; width: 78px; color: #555; flex-shrink: 0; }
.tut-bmini .bw { flex: 1; height: 16px; background: #eef0f2; border-radius: 4px; overflow: hidden; }
.tut-bmini .bf { height: 100%; border-radius: 4px; display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; color: #fff; font-size: 0.65rem; font-weight: 600; }

.tut-success .check {
  width: 60px; height: 60px; border-radius: 50%; background: #2e7d5b; color: #fff; font-size: 28px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
}

@media (max-width: 420px) {
  .tut-body { padding: 6px 14px 4px; }
  .tut-nav { padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); }
  .tut-head { padding: 14px 14px 4px; }
  .tut-title { font-size: 1.15rem; }
  .tut-illo-box { padding: 14px; min-height: 190px; }
}

/* ---------- Tutorial embutido (gerente de loteamento) — reaproveita as classes .tut-* acima ---------- */
.tut-scope-badge {
  display: inline-flex; align-items: center; gap: 7px; background: #eef3f8; border: 1px solid #d6e2ee;
  color: #2c4a63; font-size: 0.78rem; font-weight: 600; padding: 7px 14px; border-radius: 20px;
}
.tut-ro-tag {
  display: inline-flex; align-items: center; gap: 6px; background: #fff8e6; border: 1px solid #f0e2b8;
  color: #7a5c00; font-size: 0.78rem; font-weight: 500; padding: 7px 14px; border-radius: 20px;
}

/* ---------- CRM: ajustes mobile ---------- */
@media (max-width: 420px) {
  main.container { padding: 1.1rem 0.8rem 3rem; }
  .card { padding: 1rem 0.9rem; }
  .kpi-tile { flex: 1 1 90px; padding: 0.8rem 0.4rem; }
  .kpi-valor { font-size: 1.45rem; }
  .bar-label { flex-basis: 68px; font-size: 0.72rem; }
  .retorno-row { flex-direction: column; }
  .retorno-row input[type="date"] { flex: 1 1 auto; }
  .export-panel .export-fields { flex-direction: column; align-items: stretch; }
  .bar-chart-largo .bar-label { flex-basis: 96px; font-size: 0.72rem; }
  .filtros-gestor select { min-width: 100%; }
  .period .p { font-size: 0.72rem; padding: 0.4rem 0.7rem; }
  th, td { padding: 0.5rem 0.35rem; font-size: 0.78rem; }
  .acoes-distribuir form { flex-direction: column; min-width: 100%; }
  .acoes-distribuir .btn { width: 100%; }
}
