:root {
  --navy: #1c2b45;
  --navy-dark: #121d30;
  --navy-soft: #2a3c5c;
  --slate: #5b6b7c;
  --slate-light: #94a3b8;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --border: #e3e7ed;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --success: #10b981;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(18, 29, 48, 0.06), 0 1px 2px rgba(18, 29, 48, 0.04);
  --shadow-lg: 0 12px 32px rgba(18, 29, 48, 0.14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI Variable", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button { font-family: inherit; }

/* ---------------------------------------------------------- auth screens */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 55%, #0d1524 100%);
}

.auth-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-logo { width: 260px; max-width: 100%; margin-bottom: 24px; }

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 20px;
  color: var(--navy);
}

.auth-card .subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 14px;
}

.field { text-align: left; margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select { cursor: pointer; }

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--navy-soft);
  box-shadow: 0 0 0 3px rgba(42, 60, 92, 0.12);
}

.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-block { width: 100%; }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { filter: brightness(0.97); }
.btn-ghost { background: transparent; color: var(--slate); }
.btn-ghost:hover { background: #eef1f5; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }

.error-msg {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}

/* ---------------------------------------------------------- app shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--navy);
  color: #dbe3ef;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo-badge {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}
.sidebar-logo-badge img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sidebar-logo-text { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: 0.2px; }

.nav-group { margin-bottom: 18px; }
.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-light);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: #cfd8e6;
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 600; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-user { font-size: 13px; color: #dbe3ef; padding: 0 10px; margin-bottom: 8px; }
.sidebar-user .role-tag { display: block; font-size: 11px; color: var(--slate-light); margin-top: 2px; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .topbar-actions { display: flex; gap: 10px; align-items: center; }

.content { flex: 1; padding: 24px; overflow-y: auto; }

/* ---------------------------------------------------------- kanban */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}

.kanban-column {
  background: #eceff3;
  border-radius: var(--radius);
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 150px);
}

.kanban-column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 13.5px;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}
.kanban-column-head .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.kanban-column-head .count {
  margin-left: auto;
  background: rgba(0,0,0,0.06);
  border-radius: 20px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
}

.kanban-cards { padding: 8px; overflow-y: auto; flex: 1; min-height: 60px; }
.kanban-cards.drag-over { background: rgba(28, 43, 69, 0.06); border-radius: 8px; }

.lead-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px 13px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: grab;
  border: 1px solid transparent;
}
.lead-card:hover { border-color: var(--border); }
.lead-card.dragging { opacity: 0.4; }
.lead-card .lead-name { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.lead-card .lead-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.lead-card .lead-origin {
  display: inline-block;
  font-size: 11px;
  background: #eef2ff;
  color: var(--navy-soft);
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 6px;
}
.lead-card .lead-assignee {
  font-size: 11.5px;
  color: var(--slate);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.lead-card .avatar {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--navy-soft); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.empty-column { padding: 18px 10px; text-align: center; color: var(--slate-light); font-size: 12.5px; }

/* ---------------------------------------------------------- cards / tables */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.panel + .panel { margin-top: 16px; }
.panel-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.panel-subtitle { font-size: 13px; color: var(--muted); margin: 0 0 16px; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
table.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge-admin { background: #eef2ff; color: var(--navy-soft); }
.badge-atendente { background: #ecfdf5; color: #047857; }
.badge-inativo { background: #f3f4f6; color: var(--muted); }
.badge-ok { background: #ecfdf5; color: #047857; }
.badge-pendente { background: #fffbeb; color: #b45309; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------------------------------------------------------- modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(18, 29, 48, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  z-index: 100;
}
.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 0; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 18px; color: var(--muted); cursor: pointer; }
.modal-body { padding: 20px 22px; max-height: 65vh; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------------------------------------------------- agendamento de atividades */
.activity-form {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 16px;
  margin-bottom: 18px;
}
.activity-form-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}
.activity-form-row { display: flex; gap: 10px; align-items: flex-end; }
.activity-form-row + .activity-form-row { margin-top: 10px; }
.activity-form .field { margin-bottom: 0; }
.activity-form .field-titulo { flex: 1; }
.activity-form .field-tipo { flex: 0 0 128px; }
.activity-form .field-data { flex: 1; }
.activity-form input, .activity-form select { background: #fff; }
.activity-form .btn { flex-shrink: 0; height: 42px; }

.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 13px;
}
.activity-item.atrasada { border-color: #fca5a5; background: #fef2f2; }
.activity-item.done { opacity: 0.6; }
.activity-icon { font-size: 15px; flex-shrink: 0; }

/* ---------------------------------------------------------- conversa de WhatsApp */
.janela-status {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  margin-bottom: 12px;
}
.janela-status.aberta { background: #ecfdf5; color: #047857; }
.janela-status.fechada { background: #fef2f2; color: var(--danger); }

.chat-thread {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 320px; overflow-y: auto;
  padding: 4px 2px 12px;
  margin-bottom: 12px;
}
.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  position: relative;
}
.chat-bubble.in { align-self: flex-start; background: #eef1f5; color: var(--text); border-bottom-left-radius: 3px; }
.chat-bubble.out { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 3px; }
.chat-bubble .chat-tag {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  opacity: 0.75; margin-bottom: 2px;
}
.chat-bubble .chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-bubble .chat-time { font-size: 10.5px; opacity: 0.65; margin-top: 4px; text-align: right; }

.chat-composer { display: flex; gap: 8px; }
.chat-composer input, .chat-composer select {
  flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.timeline li:last-child { border-bottom: none; }
.timeline .ev-desc { color: var(--text); }
.timeline .ev-meta { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

.tabs-row { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.tab-btn {
  padding: 9px 4px; margin-right: 14px; white-space: nowrap; flex-shrink: 0;
  border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--navy); border-bottom-color: var(--navy); }

/* ---------------------------------------------------------- toast */
#toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--navy-dark); color: #fff;
  padding: 12px 18px; border-radius: 8px; font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { background: var(--danger); }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.text-muted { color: var(--muted); }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .icon { font-size: 34px; margin-bottom: 10px; }

.stage-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px;
  background: #fff;
}
.stage-row .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.stage-row .stage-name { flex: 1; font-weight: 600; font-size: 13.5px; }
.stage-row .stage-actions { display: flex; gap: 4px; }

.config-status {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  margin-bottom: 18px;
}
.config-status.off { background: #fffbeb; color: #b45309; }
.config-status.on { background: #ecfdf5; color: #047857; }

.stats-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-tile {
  flex: 1; min-width: 120px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px;
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--navy); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-label { width: 160px; flex-shrink: 0; color: var(--text); }
.bar-track { flex: 1; background: #eef1f5; border-radius: 20px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; min-width: 3px; }
.bar-value { width: 34px; text-align: right; font-weight: 600; color: var(--slate); flex-shrink: 0; }

/* ---------------------------------------------------------- lead parado (deal rotting) */
.lead-card.stale { border-color: #fbbf24; box-shadow: 0 0 0 1px #fbbf24 inset, var(--shadow); }
.lead-card .stale-flag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: #b45309;
  background: #fffbeb; padding: 2px 7px; border-radius: 20px; margin-top: 6px;
}
/* lead atribuído + parado é mais grave que só parado — dono sumiu e ninguém mais enxerga o lead */
.lead-card.stale:has(.stale-flag.locked) { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset, var(--shadow); }
.lead-card .stale-flag.locked { color: var(--danger); background: var(--danger-bg); }

/* sino de mensagem não lida — pulsa pra chamar atenção do atendente */
.lead-card.has-unread { border-color: #6366f1; box-shadow: 0 0 0 1px #6366f1 inset, var(--shadow); }
.lead-card .novo-msg-flag {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #6366f1;
  background: #eef2ff;
  border-radius: 6px;
  padding: 2px 7px;
  animation: pisca-sino 1.6s ease-in-out infinite;
}
@keyframes pisca-sino {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* ---------------------------------------------------------- toggle de ação nas automações */
.acao-toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.acao-toggle-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 170px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--slate);
  background: var(--card-bg);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}
.acao-toggle-opt input[type="radio"] { display: none; }
.acao-toggle-opt:hover { border-color: #6366f1; color: var(--text); }
.acao-toggle-opt.selected {
  border-color: #6366f1;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
}

/* ---------------------------------------------------------- página de configurações (layout lateral) */
.cfg-layout {
  display: flex;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 520px;
  overflow: hidden;
}
.cfg-nav {
  width: 196px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f8fafc;
}
.cfg-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--slate);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  width: 100%;
}
.cfg-nav-item:hover { background: var(--border); color: var(--text); }
.cfg-nav-item.active { background: var(--navy); color: #fff; font-weight: 600; }
.cfg-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}
.cfg-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.cfg-section-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.5;
}
.cfg-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.cfg-form { max-width: 520px; }
.cfg-foot { margin-top: 20px; }
.cfg-integ-item {
  margin-bottom: 24px;
}
.cfg-integ-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}
.cfg-integ-desc {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── Sobre ── */
.sobre-logo-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.sobre-logo { height: 48px; width: 48px; object-fit: contain; border-radius: 10px; }
.sobre-produto { font-size: 22px; font-weight: 700; color: var(--navy); }
.sobre-versao  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sobre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.sobre-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.sobre-card-title { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.sobre-card-val   { font-size: 13.5px; font-weight: 600; color: var(--text); }
.sobre-card-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sobre-secao { margin-bottom: 24px; }
.sobre-secao-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.sobre-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sobre-chip {
  font-size: 12px; font-weight: 500;
  background: var(--navy); color: #fff;
  border-radius: 20px; padding: 3px 12px;
}
.sobre-links { display: flex; flex-wrap: wrap; gap: 10px; }
.sobre-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--navy); font-weight: 500;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.sobre-link:hover { background: var(--bg); border-color: var(--navy); }
.sobre-footer { font-size: 12px; color: var(--muted); margin-top: 32px; }

/* ---------------------------------------------------------- painel de atividades pendentes */
.pendencias-panel { margin-bottom: 18px; }
.pendencias-list { display: flex; flex-direction: column; gap: 8px; }
.pendencia-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 13px;
}
.pendencia-item.atrasada { border-color: #fca5a5; background: #fef2f2; }
.pendencia-item .pend-info { flex: 1; min-width: 0; }
.pendencia-item .pend-title { font-weight: 600; }
.pendencia-item .pend-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pendencia-item.atrasada .pend-meta { color: #b91c1c; }

.webhook-box {
  background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px;
  padding: 12px 14px; font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px;
  word-break: break-all; color: var(--navy-soft);
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 16px; }
}

/* ─────────────────────── Monetização ───────────────────────── */

/* ── Banners de trial ── */
.trial-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  flex-wrap: wrap;
}
.trial-banner-link {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  white-space: nowrap;
  margin-left: auto;
}
.trial-aviso {
  background: #eff6ff;
  color: #1e40af;
  border-bottom: 1px solid #bfdbfe;
}
.trial-aviso .trial-banner-link { color: #1d4ed8; }
.trial-urgente {
  background: #fff7ed;
  color: #9a3412;
  border-bottom: 1px solid #fed7aa;
}
.trial-urgente .trial-banner-link { color: #b45309; }
.trial-danger {
  background: #fef2f2;
  color: #7f1d1d;
  border-bottom: 2px solid #fca5a5;
  animation: pisca-trial 2s ease-in-out infinite;
}
.trial-danger .trial-banner-link { color: #dc2626; }
@keyframes pisca-trial {
  0%, 100% { background: #fef2f2; }
  50%       { background: #fee2e2; }
}

/* ── Login suspenso ── */
.auth-card-suspenso {
  text-align: center;
  max-width: 420px;
}
.suspenso-icon { font-size: 48px; margin-bottom: 8px; }
.auth-card-suspenso h1 { color: var(--danger); margin-bottom: 8px; }
.auth-card-suspenso .subtitle { margin-bottom: 24px; }
.suspenso-box {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.suspenso-box-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.suspenso-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
}
.suspenso-contact:hover { color: var(--danger); }

/* ── Superadmin nav link ── */
.nav-link-super { color: #f59e0b !important; }
.nav-link-super:hover { background: rgba(245, 158, 11, 0.12) !important; }
.nav-link-super.active { background: #92400e !important; color: #fef3c7 !important; }

/* ── Painel superadmin — estatísticas ── */
.sa-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.sa-stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  box-shadow: var(--shadow);
}
.sa-stat-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
}
.sa-stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.sa-stat-ok   .sa-stat-val { color: var(--success); }
.sa-stat-trial .sa-stat-val { color: #d97706; }
.sa-stat-danger .sa-stat-val { color: var(--danger); }

/* ── Badges extras ── */
.badge-info { background: #eff6ff; color: #1d4ed8; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* ── Motos Elétricas: tags no card ── */
.lead-model-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #6366f1;
  background: #eef2ff;
  border-radius: 4px;
  padding: 2px 6px;
  margin: 2px 2px 0 0;
}
.lead-fin-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 6px;
  margin: 2px 0 0 0;
}
.lead-fin-tag.fin-solicitado { background: #fef9c3; color: #a16207; }
.lead-fin-tag.fin-em_analise { background: #e0f2fe; color: #0369a1; }
.lead-fin-tag.fin-aprovado   { background: #dcfce7; color: #15803d; }
.lead-fin-tag.fin-reprovado  { background: #fee2e2; color: #b91c1c; }

/* ── Ficha do cliente ── */
a.btn { text-decoration: none; }
.fc-voltar { color: var(--muted); text-decoration: none; font-weight: 500; }
.fc-voltar:hover { color: var(--navy); }
.fc-sep { color: var(--muted); font-weight: 400; margin: 0 4px; }
#ficha .panel { margin-bottom: 16px; }
.fc-cabecalho { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.fc-avatar {
  width: 60px; height: 60px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy); color: #fff; font-size: 21px; font-weight: 700;
}
.fc-identidade { flex: 1; min-width: 240px; }
.fc-nome { font-size: 20px; font-weight: 700; color: var(--navy); }
.fc-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.fc-contatos { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin-top: 8px; }
.fc-completo { width: 230px; }
.fc-completo-topo { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.fc-completo-topo strong { color: var(--navy); }
.fc-meter { height: 8px; border-radius: 4px; background: #e3e8f0; margin: 6px 0; overflow: hidden; }
.fc-meter-fill { height: 100%; border-radius: 4px; background: var(--navy-soft); }
.fc-completo-falta { font-size: 11.5px; color: var(--muted); line-height: 1.35; }

.fc-motos { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.fc-moto {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
  cursor: pointer; font: inherit; text-align: left;
}
.fc-moto:hover { border-color: var(--navy-soft); }
.fc-moto.ativa { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.fc-moto-nome { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.fc-moto-id { font-size: 11.5px; color: var(--muted); }
.fc-moto-nova { justify-content: center; border-style: dashed; color: var(--navy); font-size: 13px; font-weight: 600; }
.fc-alerta {
  border: 1px solid #f5b5b5; background: #fef2f2; color: #a11d1d;
  border-radius: 10px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 16px;
}
.fc-alerta-aviso { border-color: #f1d98a; background: #fffbeb; color: #8a5a06; }
.fc-hint-bloco { margin: -4px 0 8px; }
.fc-lista-espaco { margin-top: 14px; }
.fc-lista-espaco:empty { display: none; }
.fc-check { display: flex; align-items: flex-end; }
.fc-check label { display: flex; align-items: center; gap: 8px; font-weight: 500; padding-bottom: 10px; }
.fc-check input { width: auto; }
.tr-item.bt-troca { background: #f5f3ff; border-color: #ddd6fe; }
#mt-cancelar-venda { margin-left: 8px; }

.fc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.fc-tile { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.fc-tile-rotulo { font-size: 12px; color: var(--muted); }
.fc-tile-valor { font-size: 19px; font-weight: 600; color: var(--navy); margin: 4px 0 2px; }
.fc-tile-detalhe { font-size: 12px; color: var(--muted); }
.fc-tile-aviso { border-color: #f1d98a; background: #fffbeb; }
.fc-tile-aviso .fc-tile-detalhe { color: #8a5a06; }
.fc-tile-alerta { border-color: #f5b5b5; background: #fef2f2; }
.fc-tile-alerta .fc-tile-valor, .fc-tile-alerta .fc-tile-detalhe { color: #a11d1d; }

.fc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1080px) { .fc-grid { grid-template-columns: minmax(0, 1fr); } }
.fc-form-secao {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); margin: 18px 0 10px;
}
.fc-form > .fc-form-secao:first-child { margin-top: 4px; }
.fc-linha { display: grid; gap: 12px; }
.fc-linha .field { margin-bottom: 12px; min-width: 0; }
.fc-linha-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fc-linha-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fc-linha-cep { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 640px) { .fc-linha-2, .fc-linha-3, .fc-linha-cep { grid-template-columns: minmax(0, 1fr); } }

.fc-grafico { position: relative; margin-bottom: 14px; }
.fc-grafico svg { display: block; width: 100%; height: auto; overflow: visible; }
.fc-grafico-vazio { padding: 28px 12px; text-align: center; border: 1px dashed var(--border); border-radius: 8px; }
.fc-g-grade { stroke: #e6eaf0; stroke-width: 1; }
.fc-g-alvo { stroke: #aab3c2; stroke-width: 1; }
.fc-g-eixo { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.fc-g-rotulo { font-size: 12px; font-weight: 600; fill: var(--navy); }
.fc-g-linha { fill: none; stroke: #2a5d9f; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fc-g-estimada { stroke-dasharray: 5 5; }
.fc-g-ponto { fill: #2a5d9f; stroke: #fff; stroke-width: 2; }
.fc-g-ponto-est { fill: #fff; stroke: #2a5d9f; }
.fc-g-ponto.ativo { r: 6.5; }
.fc-g-mira { stroke: #aab3c2; stroke-width: 1; }
.fc-g-alvo-hover { fill: transparent; cursor: crosshair; }
.fc-g-alvo-hover:focus-visible { outline: 2px solid var(--navy-soft); outline-offset: 2px; }
.fc-g-dica {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  background: var(--navy-dark); color: #fff; border-radius: 6px; padding: 6px 10px; font-size: 12px;
  display: flex; flex-direction: column; gap: 1px;
}
.fc-g-dica[hidden] { display: none; }
.fc-g-dica strong { font-size: 13px; }
.fc-g-dica span { opacity: .8; }

.fc-leitura-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end; margin-bottom: 14px; }
.fc-leitura-form .field { margin-bottom: 0; min-width: 0; }
@media (max-width: 640px) { .fc-leitura-form { grid-template-columns: minmax(0, 1fr); } }
.fc-tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.fc-tabela th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.fc-tabela td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.fc-tabela .fc-num { text-align: right; font-variant-numeric: tabular-nums; }
.fc-tabela .fc-acao { text-align: right; width: 1%; }
.fc-concluir { border-top: 1px solid var(--border); margin-top: 16px; }

/* ── Relacionamento, satisfação e documentos ── */
.fc-lista-simples { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.fc-lista-simples li { padding: 5px 0; display: flex; align-items: center; gap: 8px; }
.sat-nota {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; background: #e3e8f0; color: var(--navy);
}
.tr-item.sat-promotor { background: #f0fdf4; border-color: #bbf7d0; }
.tr-item.sat-promotor .sat-nota { background: #bbf7d0; color: #14532d; }
.tr-item.sat-detrator { background: #fef2f2; border-color: #fecaca; }
.tr-item.sat-detrator .sat-nota { background: #fecaca; color: #7f1d1d; }
.doc-linha {
  display: grid; grid-template-columns: minmax(0, 1.4fr) 130px minmax(0, 1.4fr) auto;
  gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.doc-linha select, .doc-linha input { min-width: 0; width: 100%; padding: 7px 9px; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; }
.doc-nome { font-size: 13.5px; font-weight: 500; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px; }
.doc-nome a { font-size: 12px; color: #2a5d9f; margin-left: 4px; }
.doc-linha.doc-dispensado .doc-nome { color: var(--muted); }
@media (max-width: 640px) { .doc-linha { grid-template-columns: minmax(0, 1fr); } }

/* ── Relatórios de vendas ── */
#rel-vendas { margin: 16px 0; }
#rel-vendas .bar-value { width: auto; min-width: 34px; white-space: nowrap; }
#rel-vendas .bar-label { width: 140px; }
.rel-duplo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.rel-duplo .panel + .panel { margin-top: 0; }
@media (max-width: 900px) { .rel-duplo { grid-template-columns: minmax(0, 1fr); } }
.rel-colunas { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; }
.rel-coluna { display: flex; flex-direction: column; align-items: center; gap: 4px; border-radius: 6px; padding: 2px 0; }
.rel-coluna:hover, .rel-coluna:focus-visible { background: #f1f5f9; outline: none; }
.rel-coluna-valor { font-size: 12px; font-weight: 600; color: var(--navy); height: 16px; }
.rel-coluna-area { height: 120px; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid #cbd5e1; }
.rel-coluna-barra { width: 100%; max-width: 24px; border-radius: 4px 4px 0 0; }
.rel-coluna-mes { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.rel-nps-nota { font-size: 40px; font-weight: 700; color: var(--navy); margin: 0 0 4px; line-height: 1; }

/* ── Tela de Clientes ── */
.cl-filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cl-filtros select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; background: #fff; }
.cl-tile { text-align: left; font: inherit; cursor: pointer; }
.cl-tile:disabled { cursor: default; opacity: .6; }
.cl-tile:not(:disabled):hover { border-color: var(--navy-soft); }
.cl-tile.ativa { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.cl-filtro-ativo { font-size: 12.5px; color: var(--muted); margin: 0 0 4px; }
.cl-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.cl-tabs { margin-bottom: 0; border-bottom: none; }
.cl-busca { flex: 1; min-width: 220px; max-width: 360px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; }
.cl-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 14px; margin-top: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  color: inherit; text-decoration: none;
}
.cl-row:hover { border-color: var(--navy-soft); background: #f8fafc; }
.cl-nome { font-weight: 600; font-size: 14px; }
.cl-meta, .cl-motivo { font-size: 12px; color: var(--muted); margin-top: 3px; }
.cl-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-aviso { background: #fef9c3; color: #a16207; }
.kanban-arquivados { font-size: 12.5px; color: var(--muted); margin: 12px 2px 0; }
.kanban-arquivados a { color: var(--navy); font-weight: 600; }

/* ── Pós-venda ── */
.lead-rev-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 6px;
  margin: 2px 0 0 0;
  background: #fef9c3;
  color: #a16207;
}
.lead-rev-tag.atrasada { background: #fee2e2; color: #b91c1c; }
.pv-resumo { border: 1px solid var(--border); border-radius: 8px; padding: 4px 12px; margin-bottom: 16px; }
.pv-linha { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; font-size: 13.5px; }
.pv-linha + .pv-linha { border-top: 1px solid var(--border); }
#pv-cancelar-venda { margin-left: 8px; }
.pv-abrir-ficha { display: inline-block; margin-bottom: 12px; text-decoration: none; }
.tr-item.rev-atrasada { background: #fef2f2; border-color: #fecaca; }

/* ── Catálogo de modelos ── */
.modelo-specs { font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 2px; }
.modelo-row.modelo-inativo .stage-name { opacity: .55; }

/* ── Aba Veículo: ficha e test ride ── */
.veiculo-fields { margin-bottom: 20px; }
.tr-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.tr-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tr-form { background: var(--bg-muted, #f8fafc); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.tr-form .field { margin-bottom: 10px; }
.tr-list { display: flex; flex-direction: column; gap: 10px; }
.tr-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.tr-item.tr-agendado  { background: #eff6ff; border-color: #bfdbfe; }
.tr-item.tr-realizado { background: #f0fdf4; border-color: #bbf7d0; }
.tr-item.tr-cancelado { background: #f9fafb; border-color: var(--border); opacity: .65; }
.tr-icon { font-size: 18px; flex-shrink: 0; }
.tr-info { flex: 1; }
.tr-modelo { font-weight: 600; font-size: 14px; }
.tr-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tr-feedback { font-size: 12px; color: #374151; margin-top: 4px; }
.tr-actions { display: flex; gap: 6px; flex-shrink: 0; }
