:root {
  --lbc-blue: #0d2f6b;
  --lbc-blue-light: #1a4a9e;
  --lbc-gray: #f4f6f9;
  --app-bg: #f4f6f9;
  --app-surface: #ffffff;
  --app-surface-muted: #f8fafc;
  --app-border: #e2e8f0;
  --app-text: #0f172a;
  --app-text-muted: #64748b;
  --app-font-size: 0.875rem;
  --app-heading-size: 1.125rem;
}

html {
  font-size: 14px;
  cursor: default !important;
}

body,
.app-content,
.sidebar,
.card,
.table,
main,
aside,
div,
span,
p,
h1, h2, h3, h4, h5, h6,
li,
td,
th {
  cursor: default !important;
}

a,
button,
.btn,
label[for],
.nav-link,
.ai-icon-link,
[role="button"],
input[type="submit"],
input[type="button"],
input[type="checkbox"],
input[type="radio"],
input[type="file"],
select,
summary {
  cursor: pointer !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="file"]),
textarea {
  cursor: text !important;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--app-bg);
  color: var(--app-text);
  font-size: var(--app-font-size);
  line-height: 1.45;
  overflow-x: hidden;
}

.app-shell {
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

h1, .h1, h2, .h2, h3, .h3 {
  font-size: var(--app-heading-size);
}

.page-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.page-subtitle {
  font-size: 0.8rem;
  color: var(--app-text-muted);
  margin-bottom: 0;
}

.rd-lote-topbar {
  background: var(--lbc-blue);
  border-radius: 0.5rem;
  color: #fff;
  padding: 0.65rem 0.85rem;
}

.rd-status-pill {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  gap: 0.35rem;
  line-height: 1.2;
  padding: 0.35rem 0.7rem;
  white-space: nowrap;
}

.rd-status-pill--connected {
  background: #16a34a;
  color: #fff;
}

.rd-status-pill--disconnected {
  background: #dc3545;
  color: #fff;
}

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: linear-gradient(135deg, #0d2f6b 0%, #1a4a9e 55%, #2d6cdf 100%);
}

.login-shell {
  width: min(100%, 420px);
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
}

.login-page .form-control.login-input {
  font-size: 16px;
  max-width: 100%;
}

.login-card {
  border: none;
  border-radius: 0.85rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  max-width: 100%;
}

.mobile-topbar {
  background: var(--lbc-blue);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1030;
  padding-top: env(safe-area-inset-top, 0px);
}

.mobile-topbar .btn-menu {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  min-height: 2.5rem;
  min-width: 2.5rem;
}

.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--lbc-blue);
  color: #fff;
  flex-shrink: 0;
}

.sidebar-desktop {
  transition: width 0.2s ease, min-width 0.2s ease, padding 0.2s ease, opacity 0.2s ease;
}

.sidebar-collapse-btn {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.92);
  display: inline-flex;
  font-size: 0.82rem;
  gap: 0.35rem;
  justify-content: center;
  padding: 0.45rem 0.65rem;
  width: 100%;
}

.sidebar-collapse-btn:hover,
.sidebar-collapse-btn:focus {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.sidebar-expand-btn {
  align-items: center;
  background: var(--lbc-blue);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-left: none;
  border-radius: 0 0.5rem 0.5rem 0;
  box-shadow: 0 4px 14px rgba(13, 47, 107, 0.25);
  color: #fff;
  display: none;
  height: 2.5rem;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  z-index: 1040;
}

@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar-expand-btn {
    display: inline-flex !important;
  }
}

.sidebar-expand-btn:hover,
.sidebar-expand-btn:focus {
  background: var(--lbc-blue-light);
  color: #fff;
}

body.sidebar-collapsed .sidebar-desktop {
  margin: 0;
  min-width: 0 !important;
  opacity: 0;
  overflow: hidden;
  padding: 0 !important;
  pointer-events: none;
  width: 0 !important;
}

body.sidebar-collapsed .app-content {
  width: 100%;
}

.sidebar-brand {
  font-size: 1rem;
  font-weight: 700;
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.85);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-sidebar-theme {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
  padding: 0.45rem 0.65rem;
  text-align: left;
}

.btn-sidebar-theme:hover,
.btn-sidebar-theme:focus {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.sidebar-theme-toggle {
  padding-top: 0.15rem;
}

.app-content {
  min-height: 100vh;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
  overflow-x: hidden;
}

.agenda-page {
  max-width: 100%;
  overflow-x: hidden;
}

.agenda-page .card-body {
  overflow-x: auto;
}

#calendar {
  min-width: 0;
}

.stat-card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 4px 16px rgba(13, 47, 107, 0.06);
}

.stat-card .card-body {
  padding: 0.85rem 1rem;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-value-sm {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

.btn-lbc {
  background: var(--lbc-blue);
  border-color: var(--lbc-blue);
  color: #fff;
  font-size: 0.85rem;
}

.btn-lbc:hover {
  background: var(--lbc-blue-light);
  border-color: var(--lbc-blue-light);
  color: #fff;
}

.btn-lead-laranja {
  background: #f97316;
  border-color: #ea580c;
  color: #fff;
}

.btn-lead-laranja:hover,
.btn-lead-laranja:focus {
  background: #ea580c;
  border-color: #c2410c;
  color: #fff;
}

.btn-lead-vermelho {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
}

.btn-lead-vermelho:hover,
.btn-lead-vermelho:focus {
  background: #b91c1c;
  border-color: #991b1b;
  color: #fff;
}

.lead-color-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.lead-color-dot-laranja {
  background: #f97316;
}

.lead-color-dot-vermelho {
  background: #dc2626;
}

.prospect-card-laranja {
  border-left: 4px solid #f97316;
}

.prospect-card-vermelho {
  border-left: 4px solid #dc2626;
}

.prospect-row-laranja td:first-child {
  box-shadow: inset 4px 0 0 #f97316;
}

.prospect-row-vermelho td:first-child {
  box-shadow: inset 4px 0 0 #dc2626;
}

.prospect-nav-actions .btn {
  white-space: nowrap;
}

.btn-prospect-action {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.05rem;
  height: 2.1rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
  width: 2.1rem;
}

.btn-prospect-action i {
  display: block;
  transition: transform 0.18s ease;
}

.btn-prospect-action:hover {
  transform: translateY(-2px) scale(1.06);
}

.btn-prospect-action:hover i {
  transform: scale(1.08);
}

.btn-prospect-action:active {
  transform: translateY(0) scale(0.97);
}

.btn-prospect-action--waze {
  background: #00d8ff;
  border-color: #00b8db;
  box-shadow: 0 4px 12px rgba(0, 216, 255, 0.28);
  color: #003344;
}

.btn-prospect-action--waze:hover {
  background: #00c4e8;
  border-color: #0099b8;
  box-shadow: 0 8px 18px rgba(0, 216, 255, 0.38);
  color: #002833;
}

.btn-prospect-action--maps {
  background: #fff;
  border-color: #ea4335;
  box-shadow: 0 4px 12px rgba(234, 67, 53, 0.18);
  color: #ea4335;
}

.btn-prospect-action--maps:hover {
  background: #fef2f1;
  border-color: #d93025;
  box-shadow: 0 8px 18px rgba(234, 67, 53, 0.28);
  color: #c5221f;
}

.btn-prospect-action--visita {
  background: var(--lbc-blue);
  border-color: var(--lbc-blue);
  box-shadow: 0 4px 12px rgba(13, 47, 107, 0.28);
  color: #fff;
}

.btn-prospect-action--visita:hover {
  background: var(--lbc-blue-light);
  border-color: var(--lbc-blue-light);
  box-shadow: 0 8px 18px rgba(13, 47, 107, 0.34);
  color: #fff;
}

.btn-prospect-action--pause {
  background: #fff;
  border-color: #f59e0b;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
  color: #d97706;
}

.btn-prospect-action--pause:hover {
  animation: prospect-action-pulse-warn 1.4s ease infinite;
  background: #fffbeb;
  border-color: #f59e0b;
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.32);
  color: #b45309;
}

.btn-prospect-action--play {
  background: #fff;
  border-color: #22c55e;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
  color: #16a34a;
}

.btn-prospect-action--play:hover {
  background: #f0fdf4;
  border-color: #16a34a;
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.3);
  color: #15803d;
}

@keyframes prospect-action-pulse-warn {
  0%,
  100% {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18), 0 8px 18px rgba(245, 158, 11, 0.32);
  }
}

@media (max-width: 767.98px) {
  .prospect-nav-actions .btn {
    padding-left: 0;
    padding-right: 0;
  }

  .btn-prospect-action {
    height: 2.25rem;
    width: 2.25rem;
  }
}

.upload-box {
  border: 2px dashed #cbd5e1;
  border-radius: 0.75rem;
  background: #fff;
  padding: 1.25rem;
}

.tab-content-card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 4px 16px rgba(13, 47, 107, 0.06);
}

.visita-form-anchor {
  display: none;
}

.visita-questionnaire-form {
  display: block;
  margin: 0;
}

.visita-form-actions {
  display: block;
}

.visita-workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.visita-tabbar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f1f5f9;
  padding: 0.5rem 0 0.75rem;
  margin: 0 -0.25rem 0.75rem;
}

.visita-tabs .nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 4.5rem;
  line-height: 1.1;
}

.visita-tab-num {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.85;
}

.visita-tab-name {
  font-size: 0.62rem;
  max-width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visita-card {
  overflow: hidden;
}

.visita-pane-header {
  padding: 0.85rem 1rem 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.visita-pane-title {
  font-size: 1rem;
  color: #0d2f6b;
}

.visita-card-body {
  background: #fff;
}

.visita-tab-content {
  position: relative;
}

.visita-tab-content .tab-pane {
  display: none;
}

.visita-tab-content .tab-pane.active {
  display: block;
}

.visita-pane-inner {
  padding: 1rem;
}

.visita-questions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.visita-question .form-control,
.visita-question .form-select {
  min-height: 2.75rem;
  font-size: 1rem;
}

.visita-mobile-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.visita-actions {
  position: sticky;
  bottom: 0;
  z-index: 15;
}

.visit-file-input {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.visit-photo-actions .btn-lg {
  min-height: 3.25rem;
  font-size: 1rem;
}

.prospects-table {
  font-size: 0.8rem;
}

.prospects-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.prospects-table td {
  vertical-align: middle;
}

.prospects-table .col-nome {
  max-width: 220px;
  word-break: break-word;
}

.prospect-card {
  border: 1px solid var(--app-border);
  border-radius: 0.65rem;
  background: var(--app-surface);
  padding: 0.75rem;
  margin-bottom: 0.65rem;
}

.prospect-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.prospect-card-meta {
  font-size: 0.75rem;
  color: var(--app-text-muted);
  margin-bottom: 0.5rem;
}

.prospect-card .badge {
  font-size: 0.68rem;
}

.search-form .form-control {
  font-size: 0.85rem;
}

.visita-tabs .nav-link {
  font-size: 0.75rem;
  padding: 0.4rem 0.65rem;
  white-space: nowrap;
}

.form-control,
.form-select {
  font-size: 0.85rem;
}

.form-label {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.alert {
  font-size: 0.85rem;
  padding: 0.6rem 0.85rem;
}

.hierarchy-card .accordion-button {
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
}

.hierarchy-card .accordion-button:not(.collapsed) {
  background: #f8fafc;
  color: inherit;
  box-shadow: none;
}

.hierarchy-badges .badge {
  font-size: 0.68rem;
  font-weight: 600;
}

.hierarchy-manager {
  background: #fff;
}

.hierarchy-table {
  font-size: 0.78rem;
}

.hierarchy-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
}

.dashboard-filters .form-label {
  font-size: 0.72rem;
  color: #64748b;
}

.ai-icon-link {
  align-items: center;
  background: #071426;
  border-radius: 0.45rem;
  box-shadow: 0 8px 20px rgba(7, 20, 38, 0.18);
  color: #62a6ff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.15rem;
  height: 2.25rem;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  width: 2.25rem;
}

.ai-icon-link:hover {
  box-shadow: 0 10px 24px rgba(7, 20, 38, 0.24);
  color: #8fc0ff;
  transform: translateY(-1px);
}

@media (max-width: 767.98px) {
  .hierarchy-badges {
    display: none;
  }

  .hierarchy-card .accordion-button {
    flex-wrap: wrap;
  }
}

.dashboard-page {
  width: 100%;
  max-width: none;
}

.dashboard-main-row {
  align-items: stretch;
}

.dashboard-col-left,
.dashboard-col-right {
  display: flex;
  flex-direction: column;
}

.dashboard-left-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.dashboard-side-panel {
  border-top: 3px solid var(--lbc-blue) !important;
  width: 100%;
}

.alert-panel-inline {
  border-left: 4px solid #f59e0b;
}

.kpi-table-block {
  flex: 0 0 auto;
}

.side-panel-spacer {
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 991.98px) {
  .side-panel-spacer {
    display: none;
  }
}

@media (min-width: 992px) {
  .dashboard-main-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .dashboard-col-left {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: none;
  }

  .dashboard-col-right {
    flex: 0 0 340px;
    max-width: 380px;
    min-width: 300px;
    width: auto;
  }

  .dashboard-col-left,
  .dashboard-col-right {
    align-self: stretch;
  }

  /* Alinha o topo do painel (Alertas/KPIs) com o card de Operação por Região,
     abaixo do título da seção à esquerda. */
  .dashboard-col-right .dashboard-side-panel {
    margin-top: calc(0.8rem * 1.5 + 0.65rem);
  }

  .dashboard-side-panel {
    min-height: 100%;
  }
}

.dashboard-block {
  display: flex;
  flex-direction: column;
}

.dashboard-block-body {
  flex: 0 0 auto;
}

.dashboard-gerentes-row .gerente-card {
  min-height: 160px;
}

.dashboard-hero {
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  border-radius: 0.85rem !important;
}

.section-title {
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.65rem;
  text-transform: uppercase;
}

.stat-card-primary { border-left: 4px solid #0d2f6b !important; }
.stat-card-warning { border-left: 4px solid #f59e0b !important; }
.stat-card-success { border-left: 4px solid #22c55e !important; }
.stat-card-info { border-left: 4px solid #0ea5e9 !important; }

.dashboard-meta .meta-pill {
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  display: flex;
  font-size: 0.8rem;
  gap: 0.5rem;
  height: 100%;
  padding: 0.65rem 0.85rem;
}

.dashboard-meta .meta-pill-danger {
  background: #fff5f5;
  border-color: #fecaca;
  color: #b91c1c;
}

.dashboard-spotlight-row {
  align-items: stretch;
}

.dashboard-charts-card {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border-radius: 0.85rem !important;
  overflow: hidden;
}

@media (min-width: 1200px) {
  .dashboard-spotlight-row .dashboard-chart-canvas-wrap {
    min-height: 360px;
  }

  .dashboard-spotlight-row .conversion-hero-value {
    font-size: clamp(2rem, 3.2vw, 2.6rem);
  }

  .dashboard-spotlight-row .conversion-funnel-step {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.65rem 0.5rem;
  }

  .dashboard-spotlight-row .conversion-funnel-cap {
    font-size: 0.7rem;
  }
}

.conversion-intel-card {
  background:
    radial-gradient(1200px 280px at 100% -20%, rgba(46, 196, 182, 0.18), transparent 55%),
    radial-gradient(900px 240px at 0% 120%, rgba(13, 59, 102, 0.12), transparent 50%),
    linear-gradient(180deg, #fff 0%, #f4f8fb 100%);
  border-radius: 0.9rem !important;
  overflow: hidden;
}

.conversion-metric {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.85rem;
  height: 100%;
  padding: 0.95rem 1rem;
}

.conversion-metric-label {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.conversion-metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.15;
  margin-top: 0.25rem;
}

.conversion-metric-hint {
  color: #94a3b8;
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.conversion-hero {
  background: linear-gradient(135deg, #0d3b66 0%, #125a8a 55%, #1b6ca8 100%);
  border-radius: 0.9rem;
  color: #fff;
  height: 100%;
  padding: 1.1rem 1.2rem;
  position: relative;
}

.conversion-hero-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.8;
  text-transform: uppercase;
}

.conversion-hero-value {
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0.2rem 0;
}

.conversion-hero-label {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.55rem;
  opacity: 0.95;
}

.conversion-hero-copy {
  font-size: 0.82rem;
  line-height: 1.4;
  opacity: 0.88;
}

.conversion-funnel {
  align-items: stretch;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.conversion-funnel-step {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.75rem;
  flex: 1 1 140px;
  min-width: 120px;
  padding: 0.75rem 0.9rem;
  text-align: center;
}

.conversion-funnel-step.is-mid {
  border-color: rgba(46, 196, 182, 0.45);
  box-shadow: inset 3px 0 0 #2ec4b6;
}

.conversion-funnel-step.is-end {
  border-color: rgba(13, 59, 102, 0.35);
  box-shadow: inset 3px 0 0 #0d3b66;
}

.conversion-funnel-num {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
}

.conversion-funnel-cap {
  color: #64748b;
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.conversion-funnel-arrow {
  align-items: center;
  color: #94a3b8;
  display: none;
  font-size: 1.1rem;
  justify-content: center;
  padding: 0 0.15rem;
}

@media (min-width: 768px) {
  .conversion-funnel {
    align-items: center;
    flex-wrap: nowrap;
  }

  .conversion-funnel-arrow {
    display: flex;
    flex: 0 0 auto;
  }
}

[data-bs-theme="dark"] .conversion-intel-card {
  background:
    radial-gradient(1000px 260px at 100% -10%, rgba(46, 196, 182, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(13, 47, 107, 0.45) 0%, rgba(6, 20, 63, 0.92) 100%);
}

[data-bs-theme="dark"] .conversion-metric,
[data-bs-theme="dark"] .conversion-funnel-step {
  background: rgba(8, 24, 56, 0.72);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .conversion-metric-label,
[data-bs-theme="dark"] .conversion-funnel-cap {
  color: rgba(255, 255, 255, 0.65);
}

[data-bs-theme="dark"] .conversion-metric-hint {
  color: rgba(255, 255, 255, 0.45);
}

.dashboard-chart-selector-wrap {
  max-width: 100%;
}

.dashboard-chart-selector {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  -webkit-overflow-scrolling: touch;
}

.dashboard-chart-selector .btn {
  border-radius: 999px !important;
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  white-space: nowrap;
}

.dashboard-chart-selector .btn.active,
.dashboard-chart-selector .btn[aria-pressed="true"] {
  background: var(--lbc-blue, #0d2f6b);
  border-color: var(--lbc-blue, #0d2f6b);
  color: #fff;
}

.dashboard-chart-canvas-wrap {
  height: 320px;
  position: relative;
  width: 100%;
}

@media (max-width: 575.98px) {
  .dashboard-chart-canvas-wrap {
    height: 280px;
  }

  .dashboard-chart-selector .btn i {
    display: none;
  }
}

[data-bs-theme="dark"] .dashboard-charts-card {
  background: linear-gradient(180deg, rgba(13, 47, 107, 0.35) 0%, rgba(6, 20, 63, 0.9) 100%);
}

.rd-outcome-card {
  border-left: 4px solid var(--lbc-blue, #0d2f6b) !important;
}

.rd-outcome-card.rd-outcome-needs-dates {
  border-left-color: #f59e0b !important;
}

.rd-amount-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  padding: 0.65rem 0.75rem;
}

[data-bs-theme="dark"] .rd-amount-box {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.rd-products-table {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  overflow: hidden;
}

.rd-products-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

[data-bs-theme="dark"] .rd-products-table {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
}

[data-bs-theme="dark"] .rd-products-table thead th {
  background: rgba(255, 255, 255, 0.04);
}

.gerente-metrics {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gerente-metrics div {
  background: #f8fafc;
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem;
}

.gerente-metrics strong {
  font-size: 1rem;
  line-height: 1.1;
}

.region-title {
  font-size: 0.95rem;
}

.region-manager-block {
  background: #fff;
}

.alert-panel {
  border-left: 4px solid #f59e0b !important;
}

.gerente-card {
  border-left: 4px solid var(--lbc-blue) !important;
}

.region-open-card {
  border-top: 3px solid var(--lbc-blue) !important;
}

.region-open-card .card-header {
  background: linear-gradient(90deg, #fff 0%, #f8fafc 100%) !important;
}

.ai-panel {
  border-left: 4px solid var(--lbc-blue) !important;
}

.ai-critica-card {
  background: #fafbfc;
}

.stat-card .stat-value.text-info {
  color: #0ea5e9 !important;
}

.stat-card .stat-value.text-danger {
  color: #dc3545 !important;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .stat-card .stat-value {
    font-size: 1.75rem;
  }
}

@media (min-width: 1200px) {
  html {
    font-size: 16px;
  }

  .sidebar {
    width: 240px;
  }

  body.sidebar-collapsed .sidebar-desktop {
    width: 0 !important;
    min-width: 0 !important;
  }

  .prospects-table .col-nome {
    max-width: 320px;
  }
}

@media (max-width: 991.98px) {
  html,
  body,
  .mobile-topbar,
  .app-content,
  .offcanvas,
  .card,
  .table,
  .stat-card,
  .prospect-card,
  .region-open-card,
  .gerente-card {
    cursor: default !important;
  }

  html *,
  body * {
    cursor: inherit !important;
  }

  a,
  button,
  .btn,
  .btn-menu,
  .nav-link,
  .ai-icon-link,
  label[for],
  select,
  input[type="submit"],
  input[type="button"],
  input[type="checkbox"],
  input[type="radio"],
  input[type="file"],
  [role="button"] {
    cursor: pointer !important;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="file"]),
  textarea {
    cursor: text !important;
  }

  .app-content {
    padding: 0.75rem !important;
  }

  .sidebar-offcanvas {
    width: min(88vw, 280px);
  }

  .sidebar-offcanvas .sidebar-brand {
    font-size: 1.15rem;
  }

  .sidebar-offcanvas .nav-link {
    font-size: 1rem;
    line-height: 1.4;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.25rem;
  }

  .sidebar-offcanvas .nav-link i {
    font-size: 1.1rem;
  }

  .sidebar-offcanvas .btn-sidebar-theme {
    font-size: 0.95rem;
    padding: 0.55rem 0.75rem;
  }

  .mobile-topbar .fw-semibold {
    font-size: 1.05rem;
  }

  .mobile-topbar .btn-menu {
    font-size: 1.1rem;
    padding: 0.35rem 0.6rem;
  }

  /* Evita zoom automático do iOS ao focar campos */
  .form-control,
  .form-select,
  textarea.form-control,
  .briefing-input,
  .visita-question .form-control,
  .visita-question .form-select {
    font-size: 16px !important;
  }

  .form-control-sm,
  .briefing-question-compact .form-control-sm {
    min-height: 2.75rem;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .visita-tabbar-wrap {
    top: calc(2.5rem + env(safe-area-inset-top, 0px));
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .visita-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .visita-tabs::-webkit-scrollbar {
    display: none;
  }

  .visita-tabs .nav-item {
    flex: 0 0 auto;
  }

  .visita-tabs .nav-link {
    min-width: 4.25rem;
    min-height: 3rem;
    padding: 0.55rem 0.55rem;
    border-radius: 0.65rem;
  }

  .visita-tab-name {
    font-size: 0.72rem;
    max-width: 5.5rem;
  }

  .visita-tab-content {
    max-height: calc(100dvh - 15rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5.5rem;
    scroll-padding-bottom: 5.5rem;
  }

  .visita-pane-inner {
    padding: 0.85rem 1rem 1rem;
  }

  .visita-question .form-label {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
  }

  .visita-actions {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Na aba Fotos, esconde Salvar/Finalizar para não competir com os CTAs de foto */
  .visita-workspace:has(#pane-fotos.active) .visita-form-actions {
    display: none !important;
  }

  .visita-mobile-nav .btn {
    min-height: 2.75rem;
    flex: 1 1 0;
    font-size: 1rem;
  }

  .btn-action-stack .btn {
    width: 100%;
    min-height: 2.75rem;
  }

  .lbc-confirm-footer {
    flex-direction: column-reverse;
    gap: 0.5rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .lbc-confirm-footer .btn {
    width: 100%;
    min-height: 2.75rem;
    margin: 0 !important;
  }
}

.visit-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.visit-photo-card {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f8f9fa;
  aspect-ratio: 1;
}

.visit-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.visit-photo-delete {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
}

.visit-photo-delete .btn {
  padding: 0.15rem 0.4rem;
  line-height: 1;
}

.status-historico-text {
  white-space: pre-line;
}

/* ---------- Agenda / Calendário ---------- */
.agenda-dot {
  border-radius: 50%;
  display: inline-block;
  height: 0.7rem;
  margin-right: 0.25rem;
  vertical-align: middle;
  width: 0.7rem;
}

.agenda-legend span {
  align-items: center;
  color: #475569;
  display: inline-flex;
}

.agenda-legend-btn {
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.82rem;
  gap: 0.15rem;
  padding: 0.3rem 0.65rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.agenda-legend-btn:hover,
.agenda-legend-btn:focus {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--lbc-blue);
}

.agenda-legend-btn--active {
  background: rgba(26, 74, 158, 0.1);
  border-color: var(--lbc-blue);
  box-shadow: 0 0 0 1px rgba(26, 74, 158, 0.15);
  color: var(--lbc-blue);
  font-weight: 600;
}

.agenda-legend-btn--clear {
  border-style: dashed;
}

#calendar {
  --fc-border-color: #e2e8f0;
  --fc-today-bg-color: rgba(26, 74, 158, 0.08);
  --fc-button-bg-color: var(--lbc-blue);
  --fc-button-border-color: var(--lbc-blue);
  --fc-button-hover-bg-color: var(--lbc-blue-light);
  --fc-button-hover-border-color: var(--lbc-blue-light);
  --fc-button-active-bg-color: var(--lbc-blue-light);
  --fc-button-active-border-color: var(--lbc-blue-light);
  --fc-event-border-color: transparent;
}

.fc .fc-toolbar-title {
  color: var(--lbc-blue);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: capitalize;
}

.fc .fc-button {
  border-radius: 0.5rem;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  text-transform: capitalize;
}

.fc .fc-daygrid-day.fc-day-today {
  font-weight: 700;
}

.fc-event {
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 1px 4px;
}

.fc-event.agenda-event-agendado {
  background-color: #1a4a9e !important;
  border-color: #1a4a9e !important;
  color: #fff;
}

.fc-event.agenda-event-concluido {
  background-color: #16a34a !important;
  border-color: #16a34a !important;
  color: #fff;
}

.fc-event.agenda-event-cancelado {
  background-color: #94a3b8 !important;
  border-color: #94a3b8 !important;
  color: #fff;
}

.fc-event.agenda-event-remarcado {
  background-color: #f59e0b !important;
  border-color: #d97706 !important;
  color: #fff;
}

.fc-event.agenda-event-em_visita {
  background-color: #0ea5e9 !important;
  border-color: #0284c7 !important;
  color: #fff;
}

.fc-event.agenda-event-remarcado .fc-event-obs {
  color: rgba(255, 255, 255, 0.92);
}

.fc-daygrid-event {
  position: relative;
  white-space: normal;
}

.agenda-note-flag {
  background: #ef4444;
  border: 2px solid #fff;
  border-radius: 50%;
  height: 0.6rem;
  position: absolute;
  right: -2px;
  top: -2px;
  width: 0.6rem;
}

.agenda-notes {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.agenda-note {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #cbd5e1;
  border-radius: 0.4rem;
  padding: 0.45rem 0.6rem;
}

.agenda-note--unread {
  background: #fff7ed;
  border-left-color: #f59e0b;
}

.agenda-visit-section {
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.agenda-detalhes-modal .modal-dialog {
  max-width: min(680px, calc(100vw - 1.5rem));
}

.agenda-detalhes-body {
  padding: 0.85rem 1rem;
}

.agenda-visit-info {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.agenda-visit-info-title {
  color: var(--app-text);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.agenda-visit-times {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr;
}

.agenda-visit-time-item {
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.6rem;
}

.agenda-visit-time-label {
  color: var(--app-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.agenda-visit-time-value {
  color: var(--app-text);
  font-size: 0.84rem;
  font-weight: 600;
}

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

@media (min-width: 576px) {
  .agenda-visit-times {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .agenda-gps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .agenda-detalhes-modal .modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
  }

  .agenda-detalhes-body {
    padding: 0.75rem;
  }

  .agenda-gps-proof {
    font-size: 0.82rem;
  }
}

.agenda-visit-btn {
  font-size: 1rem;
  font-weight: 600;
  min-height: 3rem;
  padding: 0.65rem 1rem;
}

.agenda-visit-completed {
  align-items: center;
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.28);
  border-radius: 0.4rem;
  color: #15803d;
  display: flex;
  font-size: 0.9rem;
  margin-bottom: 0;
  padding: 0.55rem 0.7rem;
}

.agenda-gps-section {
  border-top: 1px dashed var(--app-border);
  padding-top: 0.75rem;
}

.agenda-gps-proof {
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: 0.4rem;
  color: var(--app-text);
  padding: 0.55rem 0.65rem;
}

.agenda-gps-proof--ok {
  border-left: 3px solid #16a34a;
}

.agenda-gps-proof--missing {
  border-left: 3px solid #f59e0b;
}

.agenda-gps-proof-title {
  color: var(--app-text);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.agenda-gps-proof-title--ok {
  color: #15803d;
}

.agenda-gps-proof-title--missing {
  color: #b45309;
}

.agenda-gps-proof-detail {
  color: var(--app-text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.agenda-gps-accuracy {
  font-weight: 600;
  margin-top: 0.15rem;
}

.agenda-gps-accuracy--ok {
  color: #16a34a;
}

.agenda-gps-accuracy--warn {
  color: #d97706;
}

.agenda-gps-accuracy--bad {
  color: #dc2626;
}

.agenda-gps-empty {
  background: var(--app-surface-muted);
  border: 1px dashed var(--app-border);
  border-radius: 0.4rem;
  color: var(--app-text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 0.65rem 0.75rem;
  text-align: center;
}

.agenda-gps-empty i {
  color: #b45309;
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.agenda-gps-empty-hint {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.agenda-obs-agendamento {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--lbc-blue);
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
}

.agenda-obs-agendamento-text {
  font-size: 0.875rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.agenda-lead-selected-card {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--lbc-blue);
  border-radius: 0.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
}

.agenda-lead-list {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  max-height: 12rem;
  overflow-y: auto;
}

.agenda-lead-item {
  background: #fff;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  display: block;
  padding: 0.55rem 0.75rem;
  text-align: left;
  width: 100%;
}

.agenda-lead-item:last-child {
  border-bottom: 0;
}

.agenda-lead-item:hover,
.agenda-lead-item:focus {
  background: #eff6ff;
}

.agenda-lead-item-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
}

.agenda-lead-item-meta {
  color: #64748b;
  display: block;
  font-size: 0.75rem;
}

.fc-event-obs {
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.2;
  opacity: 0.92;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .fc .fc-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 0.5rem;
  }

  .fc .fc-toolbar-title {
    font-size: 0.98rem;
    text-align: center;
  }

  .fc .fc-button {
    font-size: 0.9rem;
    padding: 0.55rem 0.75rem;
    min-height: 2.5rem;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
  }

  .fc .fc-button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .agenda-legend-btn {
    min-height: 2.5rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
  }
}

.prospect-actions-toggle::after {
  display: none;
}

.prospect-actions-menu {
  --bs-dropdown-min-width: 12rem;
  z-index: 1080;
}

.prospect-actions.show {
  position: relative;
  z-index: 1080;
}

.prospects-table tbody tr:has(.prospect-actions.show) {
  position: relative;
  z-index: 5;
}

.prospect-card:has(.prospect-actions.show) {
  position: relative;
  z-index: 5;
}

.prospect-actions-menu .dropdown-item {
  padding-bottom: 0.5rem;
  padding-top: 0.5rem;
}

.prospect-actions-menu form {
  margin: 0;
}

/* Modal de leitura obrigatória */
.mandatory-note-item {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f59e0b;
  border-radius: 0.5rem;
  margin-bottom: 0.6rem;
  padding: 0.7rem 0.85rem;
}

/* ---------- Tema escuro / claro (LBC azul) ---------- */
[data-bs-theme="dark"] {
  /* TESTE: fundo do modo escuro — #06143F (reverter se não gostar) */
  --lbc-gray: #06143F;
  --app-bg: #06143F;
  --app-surface: #0a2247;
  --app-surface-muted: #0d2f6b;
  --app-surface-deep: #06143F;
  --app-border: rgba(255, 255, 255, 0.16);
  --app-text: #ffffff;
  --app-text-muted: rgba(255, 255, 255, 0.72);

  --bs-body-bg: #06143F;
  --bs-body-color: #ffffff;
  --bs-emphasis-color: #ffffff;
  --bs-secondary-color: rgba(255, 255, 255, 0.72);
  --bs-tertiary-color: rgba(255, 255, 255, 0.55);
  --bs-border-color: rgba(255, 255, 255, 0.16);
  --bs-card-bg: #0a2247;
  --bs-card-color: #ffffff;
  --bs-modal-bg: #0a2247;
  --bs-dropdown-bg: #0d2f6b;
  --bs-dropdown-link-color: #ffffff;
  --bs-dropdown-link-hover-bg: rgba(255, 255, 255, 0.1);
  --bs-form-control-bg: #0d2f6b;
  --bs-form-control-color: #ffffff;
  --bs-form-control-border-color: rgba(255, 255, 255, 0.22);
  --bs-form-select-bg: #0d2f6b;
  --bs-table-color: #ffffff;
  --bs-table-border-color: rgba(255, 255, 255, 0.12);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.04);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.08);

  color-scheme: dark;
}

[data-bs-theme="dark"] body {
  background: var(--app-bg);
  color: var(--app-text);
}

[data-bs-theme="dark"] .app-content {
  background: var(--app-bg);
  color: var(--app-text);
}

[data-bs-theme="dark"] .page-title,
[data-bs-theme="dark"] .section-title,
[data-bs-theme="dark"] .fw-bold,
[data-bs-theme="dark"] .fw-semibold,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .card-body,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .prospect-card,
[data-bs-theme="dark"] .prospect-card-name,
[data-bs-theme="dark"] .upload-box,
[data-bs-theme="dark"] .tab-content-card,
[data-bs-theme="dark"] .dashboard-hero,
[data-bs-theme="dark"] .dashboard-side-panel,
[data-bs-theme="dark"] .region-open-card,
[data-bs-theme="dark"] .gerente-card,
[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .meta-pill,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .hierarchy-card,
[data-bs-theme="dark"] .visita-pane,
[data-bs-theme="dark"] .briefing-pane-header,
[data-bs-theme="dark"] .briefing-form-footer,
[data-bs-theme="dark"] .visit-photo-card,
[data-bs-theme="dark"] .ai-panel,
[data-bs-theme="dark"] .ai-critica-card {
  background: var(--app-surface) !important;
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
}

[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .card-header.bg-white,
[data-bs-theme="dark"] .region-open-card .card-header,
[data-bs-theme="dark"] .region-manager-block {
  background: var(--app-surface-muted) !important;
  color: var(--app-text) !important;
}

[data-bs-theme="dark"] .dashboard-hero {
  background: linear-gradient(135deg, #0a2247 0%, #0d2f6b 100%) !important;
}

[data-bs-theme="dark"] .page-subtitle,
[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .prospect-card-meta,
[data-bs-theme="dark"] .stat-card .stat-label,
[data-bs-theme="dark"] .gerente-metrics span.text-muted,
[data-bs-theme="dark"] .small.text-muted,
[data-bs-theme="dark"] .kpi-table-block .text-muted {
  color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .stat-card {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .stat-card .stat-value.text-primary {
  color: #93c5fd !important;
}

[data-bs-theme="dark"] .stat-card .stat-value.text-warning,
[data-bs-theme="dark"] .text-warning {
  color: #fcd34d !important;
}

[data-bs-theme="dark"] .stat-card .stat-value.text-success,
[data-bs-theme="dark"] .text-success {
  color: #86efac !important;
}

[data-bs-theme="dark"] .stat-card .stat-value.text-info,
[data-bs-theme="dark"] .text-info {
  color: #7dd3fc !important;
}

[data-bs-theme="dark"] .stat-card .stat-value.text-danger,
[data-bs-theme="dark"] .text-danger {
  color: #fca5a5 !important;
}

[data-bs-theme="dark"] .text-primary {
  color: #93c5fd !important;
}

[data-bs-theme="dark"] .table-light {
  --bs-table-bg: var(--app-surface-muted);
  --bs-table-color: var(--app-text);
  --bs-table-border-color: var(--app-border);
}

[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] .hierarchy-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--app-text);
  --bs-table-border-color: var(--app-border);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
  color: var(--app-text);
}

[data-bs-theme="dark"] .table thead th {
  color: var(--app-text-muted);
}

[data-bs-theme="dark"] .badge.rounded-pill.text-bg-light {
  background: var(--app-surface-muted) !important;
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
}

[data-bs-theme="dark"] .btn-outline-secondary {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: var(--app-surface-muted);
  border-color: var(--app-border);
  color: var(--app-text);
}

[data-bs-theme="dark"] .form-control::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

[data-bs-theme="dark"] .form-label {
  color: var(--app-text);
}

[data-bs-theme="dark"] .gerente-metrics div {
  background: var(--app-surface) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 0.75rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  color: var(--app-text) !important;
}

[data-bs-theme="dark"] .gerente-metrics div:nth-child(1) {
  border-left: 4px solid #93c5fd !important;
}

[data-bs-theme="dark"] .gerente-metrics div:nth-child(2) {
  border-left: 4px solid #fcd34d !important;
}

[data-bs-theme="dark"] .gerente-metrics div:nth-child(3) {
  border-left: 4px solid #86efac !important;
}

[data-bs-theme="dark"] .gerente-metrics div:nth-child(4) {
  border-left: 4px solid #7dd3fc !important;
}

[data-bs-theme="dark"] .gerente-metrics strong {
  color: #fff;
}

[data-bs-theme="dark"] .meta-pill-danger {
  background: rgba(185, 28, 28, 0.35) !important;
  border-color: rgba(252, 165, 165, 0.45) !important;
  color: #fecaca !important;
}

[data-bs-theme="dark"] .alert-panel-inline {
  border-left-color: #fcd34d;
  border-bottom-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .agenda-obs-agendamento {
  background: var(--app-surface-muted);
  border-color: var(--app-border);
}

[data-bs-theme="dark"] .agenda-legend-btn {
  background: var(--app-surface-muted);
  border-color: var(--app-border);
  color: var(--app-text-muted);
}

[data-bs-theme="dark"] .agenda-legend-btn:hover,
[data-bs-theme="dark"] .agenda-legend-btn:focus {
  background: var(--app-surface);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--app-text);
}

[data-bs-theme="dark"] .agenda-legend-btn--active {
  background: rgba(26, 74, 158, 0.35);
  border-color: #60a5fa;
  color: #fff;
}

[data-bs-theme="dark"] .agenda-obs-agendamento-text {
  color: var(--app-text);
}

[data-bs-theme="dark"] .agenda-visit-completed {
  background: rgba(22, 163, 74, 0.16);
  border-color: rgba(74, 222, 128, 0.32);
  color: #bbf7d0;
}

[data-bs-theme="dark"] .agenda-visit-section,
[data-bs-theme="dark"] .agenda-visit-info,
[data-bs-theme="dark"] .agenda-visit-time-item,
[data-bs-theme="dark"] .agenda-gps-proof,
[data-bs-theme="dark"] .agenda-gps-empty {
  background: var(--app-surface-muted);
  border-color: var(--app-border);
  color: var(--app-text);
}

[data-bs-theme="dark"] .agenda-visit-info-title,
[data-bs-theme="dark"] .agenda-visit-time-value,
[data-bs-theme="dark"] .agenda-gps-proof-title {
  color: var(--app-text);
}

[data-bs-theme="dark"] .agenda-gps-proof-title--ok {
  color: #86efac;
}

[data-bs-theme="dark"] .agenda-gps-proof-title--missing,
[data-bs-theme="dark"] .agenda-gps-empty i {
  color: #fcd34d;
}

[data-bs-theme="dark"] .agenda-gps-proof-detail,
[data-bs-theme="dark"] .agenda-gps-empty,
[data-bs-theme="dark"] .agenda-gps-empty-hint {
  color: var(--app-text-muted);
}

[data-bs-theme="dark"] .agenda-note {
  background: var(--app-surface-muted);
  border-color: var(--app-border);
  color: var(--app-text);
}

[data-bs-theme="dark"] .agenda-note--unread {
  background: rgba(245, 158, 11, 0.22);
  border-left-color: #fcd34d;
}

[data-bs-theme="dark"] .agenda-lead-selected-card,
[data-bs-theme="dark"] .agenda-lead-list,
[data-bs-theme="dark"] .agenda-lead-item {
  background: var(--app-surface-muted);
  border-color: var(--app-border);
  color: var(--app-text);
}

[data-bs-theme="dark"] .agenda-lead-item-meta {
  color: var(--app-text-muted);
}

[data-bs-theme="dark"] .agenda-lead-item:hover,
[data-bs-theme="dark"] .agenda-lead-item:focus {
  background: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .status-historico,
[data-bs-theme="dark"] .bg-light {
  background: var(--app-surface-muted) !important;
  color: var(--app-text) !important;
}

[data-bs-theme="dark"] #calendar {
  --fc-border-color: rgba(255, 255, 255, 0.16);
  --fc-page-bg-color: var(--app-surface);
  --fc-neutral-bg-color: var(--app-surface-muted);
  --fc-today-bg-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .fc .fc-toolbar-title,
[data-bs-theme="dark"] .fc .fc-col-header-cell-cushion,
[data-bs-theme="dark"] .fc .fc-daygrid-day-number {
  color: #fff;
}

[data-bs-theme="dark"] .fc .fc-button-primary {
  background: var(--app-surface-muted);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

[data-bs-theme="dark"] .mandatory-note-item {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(252, 211, 77, 0.45);
  color: #fff;
}

[data-bs-theme="dark"] .dropdown-item {
  color: var(--app-text);
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
  background: rgba(255, 255, 255, 0.1);
  color: var(--app-text);
}

[data-bs-theme="dark"] .dropdown-divider {
  border-color: var(--app-border);
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
  border-color: var(--app-border);
}

[data-bs-theme="dark"] hr,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom {
  border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .alert-warning-subtle,
[data-bs-theme="dark"] .bg-warning-subtle {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fff !important;
}

/* Blocos internos do dashboard — eliminar branco residual */
[data-bs-theme="dark"] .region-open-card .card-body,
[data-bs-theme="dark"] .region-manager-block,
[data-bs-theme="dark"] .hierarchy-manager,
[data-bs-theme="dark"] .gerente-card .card-body,
[data-bs-theme="dark"] .dashboard-side-panel .kpi-table-block,
[data-bs-theme="dark"] .alert-panel-inline {
  background: var(--app-surface) !important;
  color: var(--app-text) !important;
}

[data-bs-theme="dark"] .region-open-card .card-header,
[data-bs-theme="dark"] .card-header.bg-white {
  background: var(--app-surface-muted) !important;
  color: var(--app-text) !important;
}

[data-bs-theme="dark"] .hierarchy-table th,
[data-bs-theme="dark"] .hierarchy-table td,
[data-bs-theme="dark"] .hierarchy-table tbody tr {
  background-color: transparent !important;
  color: var(--app-text) !important;
  border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .hierarchy-table thead th {
  background-color: rgba(0, 0, 0, 0.2) !important;
  color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .hierarchy-table tbody tr:hover td {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .badge.text-bg-light {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .meta-pill {
  background: var(--app-surface) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 0.75rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  color: var(--app-text) !important;
}

[data-bs-theme="dark"] .meta-pill i {
  color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .meta-pill strong {
  color: #fff;
}

[data-bs-theme="dark"] .section-title {
  color: rgba(255, 255, 255, 0.88) !important;
}

[data-bs-theme="dark"] .dashboard-filters .form-label {
  color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .shadow-sm {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35) !important;
}

[data-bs-theme="dark"] .accordion-button,
[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
  background: var(--app-surface-muted) !important;
  color: var(--app-text) !important;
}

[data-bs-theme="dark"] .accordion-body {
  background: var(--app-surface) !important;
  color: var(--app-text) !important;
}

/* ===================== Briefing module ===================== */
.briefing-page {
  max-width: 100%;
  overflow-x: hidden;
}

.briefing-tabbar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--app-bg);
  padding: 0.5rem 0 0.75rem;
  margin-bottom: 0.75rem;
}

.briefing-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.briefing-tabs::-webkit-scrollbar {
  display: none;
}

.briefing-tabs .nav-item {
  flex: 0 0 auto;
}

.briefing-tabs .nav-link {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.briefing-card {
  overflow: hidden;
}

.briefing-pane-header {
  padding: 0.85rem 1rem 0.5rem;
  border-bottom: 1px solid var(--app-border, #dee2e6);
  background: var(--app-surface, #fff);
}

.briefing-tab-content {
  position: relative;
}

.briefing-tab-content .tab-pane {
  display: none;
}

.briefing-tab-content .tab-pane.active {
  display: block;
}

.briefing-pane-inner {
  padding: 1rem;
}

.briefing-form-footer {
  background: var(--app-surface, #fff);
}

.briefing-tab-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #adb5bd;
  flex: 0 0 auto;
}
.section-dot-nao_iniciada { background: #adb5bd; }
.section-dot-em_preenchimento { background: #ffc107; }
.section-dot-com_pendencias { background: #dc3545; }
.section-dot-concluida { background: #198754; }

.briefing-workspace .tab-pane:not(.active) { display: none; }

.briefing-choice {
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 8px;
  padding: 10px 12px 10px 40px;
  margin-bottom: 8px;
  cursor: pointer;
}
.briefing-choice:hover { background: rgba(13, 59, 102, 0.05); }
.briefing-choice .form-check-input { margin-left: -1.6rem; margin-top: 0.2rem; }
.briefing-choice .form-check-label { cursor: pointer; }
.briefing-choice:has(.form-check-input:checked) {
  border-color: #0d3b66;
  background: rgba(13, 59, 102, 0.08);
}

.briefing-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.35rem 0.75rem;
}

.briefing-choice-compact {
  padding: 0.35rem 0.5rem 0.35rem 1.75rem;
  margin-bottom: 0;
  border: none;
  background: transparent;
}

.briefing-choice-compact:hover {
  background: rgba(13, 59, 102, 0.05);
  border-radius: 0.35rem;
}

.briefing-choice-compact .form-check-input {
  margin-left: -1.35rem;
  margin-top: 0.15rem;
}

.briefing-choice-inline {
  padding: 0.35rem 0.75rem;
  margin-bottom: 0;
  min-width: 5rem;
}

.briefing-question-grid .briefing-choice-compact .form-check-label {
  font-size: 0.85rem;
  line-height: 1.2;
}

.briefing-id-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.briefing-id-row {
  display: grid;
  gap: 0.5rem 0.75rem;
  align-items: start;
}

.briefing-id-row--1 {
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
}

.briefing-id-row--2 {
  grid-template-columns: minmax(0, 40fr) minmax(0, 6fr) minmax(0, 15fr);
}

.briefing-id-row--3 {
  grid-template-columns: minmax(0, 1fr) minmax(3.5rem, 4.5rem) minmax(0, 8.5rem);
}

.briefing-id-row--4 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.briefing-question-compact {
  margin-bottom: 0;
}

.briefing-question-compact .form-label {
  margin-bottom: 0.25rem;
}

.briefing-question-compact .form-control-sm {
  min-height: calc(1.5em + 0.5rem + 2px);
}

.briefing-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.75rem 1rem;
  align-items: start;
}

.briefing-field-cell--full {
  grid-column: 1 / -1;
}

/* Bandeira do posto: uma linha; no celular desliza horizontalmente */
.briefing-bandeira-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding: 0.15rem 0 0.35rem;
  scrollbar-width: thin;
}

.briefing-bandeira-row .briefing-bandeira-chip {
  flex: 0 0 auto;
  margin-bottom: 0;
  white-space: nowrap;
}

.briefing-bandeira-row .briefing-bandeira-chip .form-check-label {
  white-space: nowrap;
  font-size: 0.8rem;
}

@media (min-width: 992px) {
  .briefing-bandeira-row {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .briefing-bandeira-row .briefing-bandeira-chip .form-check-label {
    font-size: 0.85rem;
  }
}

/* IBM: cabe 14 dígitos — não estica na largura da tela */
.briefing-ibm {
  width: 16ch;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.briefing-locked > label::after {
  content: " · definido pelos módulos (GPA/GP)";
  font-weight: 400;
  font-size: 0.75rem;
  color: #6c757d;
}

.briefing-locked-choice {
  border-color: #0d3b66 !important;
  background: rgba(13, 59, 102, 0.08) !important;
  cursor: not-allowed;
}

.briefing-locked-choice .form-check-label::after {
  content: " (obrigatório)";
  font-weight: 400;
  font-size: 0.75rem;
  color: #6c757d;
}

.briefing-locked .briefing-choice:has(input:disabled) {
  opacity: 1 !important;
  cursor: not-allowed;
  pointer-events: none;
  background: #fff;
  border-style: dashed;
  border-color: #adb5bd;
}

.briefing-locked .briefing-choice:has(input:disabled) .form-check-label,
.briefing-locked .briefing-choice:has(input:disabled) .form-check-input {
  cursor: not-allowed;
  opacity: 1 !important;
  color: #212529 !important;
  -webkit-text-fill-color: #212529;
}

.briefing-question-compact .briefing-choice-inline {
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 8px;
  padding: 0.3rem 0.6rem 0.3rem 2rem;
  min-width: auto;
}

.briefing-question-compact .briefing-choice-inline .form-check-input {
  margin-left: -1.5rem;
  margin-top: 0.2rem;
}

.briefing-question-compact .briefing-choice-inline .form-check-label {
  font-size: 0.85rem;
  white-space: nowrap;
}

.briefing-question-compact .briefing-choice-inline:has(.form-check-input:checked) {
  border-color: #0d3b66;
  background: rgba(13, 59, 102, 0.08);
}

.briefing-question.is-invalid-question {
  border-left: 3px solid #dc3545;
  padding-left: 10px;
  background: rgba(220, 53, 69, 0.04);
  border-radius: 6px;
}

@media (max-width: 991.98px) {
  .briefing-tabbar-wrap {
    top: calc(2.5rem + env(safe-area-inset-top, 0px));
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .briefing-tabs .nav-link {
    min-height: 2.75rem;
    padding: 0.55rem 0.85rem;
  }

  .briefing-tab-content {
    max-height: calc(100dvh - 16rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6rem;
    scroll-padding-bottom: 6rem;
  }

  .briefing-form-footer {
    position: sticky;
    bottom: 0;
    z-index: 15;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)) !important;
    gap: 0.5rem !important;
  }

  .briefing-form-footer .btn,
  .briefing-actions-card .btn {
    min-height: 2.75rem;
  }

  .briefing-choice-compact {
    padding: 0.7rem 0.65rem 0.7rem 2.1rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.5rem;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
  }

  .briefing-choice-compact .form-check-input {
    width: 1.2rem;
    height: 1.2rem;
    margin-left: -1.55rem;
  }

  .briefing-question-grid .briefing-choice-compact .form-check-label {
    font-size: 0.95rem;
    line-height: 1.3;
  }

  .briefing-question-compact .briefing-choice-inline {
    min-height: 2.75rem;
    padding: 0.55rem 0.85rem 0.55rem 2.15rem;
    display: inline-flex;
    align-items: center;
  }

  .briefing-question-compact .briefing-choice-inline .form-check-label {
    white-space: normal;
    font-size: 0.95rem;
  }

  .briefing-select-all-btn {
    min-height: 2.5rem;
  }
}

/* Desktop: menu lateral fixo; só a área de conteúdo rola (todas as telas). */
@media (min-width: 992px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .sidebar-desktop {
    position: relative;
    align-self: stretch;
    height: 100%;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 1020;
  }

  .app-content {
    position: relative;
    z-index: 1;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 767.98px) {
  .briefing-id-row--1,
  .briefing-id-row--2,
  .briefing-id-row--3,
  .briefing-id-row--4 {
    grid-template-columns: 1fr;
  }

  .briefing-field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .briefing-choice { padding: 14px 12px 14px 44px; min-height: 2.75rem; }
  .briefing-tabs .nav-link { font-size: 0.85rem; }

  .briefing-check-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .briefing-form-footer {
    flex-direction: column;
    align-items: stretch !important;
  }

  .briefing-form-footer > div {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .briefing-form-footer .btn {
    width: 100%;
    font-size: 0.95rem;
  }

  .briefing-actions-card .card-body {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .briefing-actions-card .btn,
  .briefing-actions-card form {
    width: 100%;
    margin: 0 !important;
  }

  .briefing-actions-card form .btn {
    width: 100%;
  }
}

@media print {
  .sidebar, .mobile-topbar, .sidebar-expand-btn, .d-print-none { display: none !important; }
  .app-content { padding: 0 !important; }
  .briefing-a4 { box-shadow: none !important; border: none !important; }
  .briefing-section-block { page-break-inside: avoid; }
}
