:root {
  /* ========================================================
     IMAGEM DE FUNDO DA TELA DE LOGIN:
     Cole a URL direta da sua imagem dentro de url('...') abaixo.
     Dica para Google Drive: use https://lh3.googleusercontent.com/d/ID_DO_ARQUIVO
     ======================================================== */
  --login-bg-image: url('https://lh3.googleusercontent.com/d/1i0j9n0eb7FUb16wJUDk1LdGE53e8UNIY');

  --bg-color: #f4f7f6;
  --card-bg: #ffffff;
  --text-main: #1a1a24;
  --text-muted: #6b7280;
  
  --primary: #4F46E5;
  --primary-hover: #4338ca;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  
  --border: #e5e7eb;
  --rad: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,0.05);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: 'Outfit', sans-serif; }

.container {
  width: 100%;
  max-width: 500px;
  padding: 24px;
  margin: 0 auto;
}

/* TELAS & LOGIN COM IMAGEM DE FUNDO */
#login-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-image: var(--login-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 20px;
  z-index: 100;
}

/* Película de contraste translúcida */
#login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.72), rgba(30, 27, 75, 0.78));
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1;
}

/* Cartão de login em vidro (Glassmorphism) */
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 36px 28px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.6);
  animation: fadeInCard 0.4s ease-out;
}

@keyframes fadeInCard {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2ff;
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

#dashboard-screen {
  display: none;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px 40px 16px;
}

#success-screen {
  display: none;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 90vh;
}

/* TIPOGRAFIA & INPUTS */
#login-screen h1 { font-size: 2rem; margin-bottom: 8px; }
#login-screen p { color: var(--text-muted); margin-bottom: 32px; }

.input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}
.input-group label {
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.input-group input {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--rad);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.input-group input:focus { outline: none; border-color: var(--primary); }

.btn {
  width: 100%;
  padding: 16px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--rad);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* DASHBOARD */
header {
  background: var(--card-bg);
  padding: 22px;
  border-radius: var(--rad);
  box-shadow: var(--shadow);
  margin: 20px auto;
  width: 100%;
  border: 1px solid var(--border);
}

.header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.badge-cas {
  background: #eef2ff;
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.prof-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge-cpf {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.4px;
}

/* CARD DE FROTA / VEÍCULO */
.frota-card {
  margin-top: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
}

.frota-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.frota-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.frota-icon {
  font-size: 1.4rem;
  background: #eef2ff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frota-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.frota-motorista {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}

.frota-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.frota-pill {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}

.frota-pill-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 2px;
}

.frota-pill-val {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card {
  background: var(--card-bg);
  border-radius: var(--rad);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
}

.card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.card-time {
  font-weight: 700;
  color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.person-name { font-weight: 600; font-size: 1.1rem; margin-bottom: 4px; }
.person-address { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; line-height: 1.4; }

/* FORMULÁRIO DE RESULTADO E FLUXO CONDICIONAL */
.action-form {
  display: none;
  margin-top: 16px;
  background: #fafafb;
  padding: 16px;
  border-radius: var(--rad);
  border: 1px solid var(--border);
}

.form-step {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}
.form-step:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.form-label {
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #334155;
  margin-bottom: 8px;
  display: block;
  line-height: 1.3;
}

.choice-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 14px;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  background: #ffffff;
  color: #475569;
  transition: all 0.15s ease;
  user-select: none;
}
.choice-pill input {
  display: none;
}
.choice-pill:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.choice-pill:has(input:checked) {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.choice-pill.pill-sim:has(input:checked) {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
}
.choice-pill.pill-nao:has(input:checked) {
  border-color: #ef4444;
  background: #fef2f2;
  color: #991b1b;
}
.choice-pill.pill-neutral:has(input:checked) {
  border-color: var(--primary);
  background: #eef2ff;
  color: var(--primary);
}

.radio-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  background: #ffffff;
  color: #1e293b;
  transition: all 0.15s ease;
  line-height: 1.3;
}
.radio-card input {
  accent-color: var(--primary);
  width: 17px;
  height: 17px;
  cursor: pointer;
  flex-shrink: 0;
}
.radio-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.radio-card:has(input:checked) {
  border-color: var(--primary);
  background: #f5f3ff;
  color: #3730a3;
  font-weight: 600;
}

.sub-step {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
}

.custom-select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 500;
  color: #1e293b;
  background-color: #ffffff;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  margin-top: 6px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234F46E5' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
.custom-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  box-shadow: none;
}
.btn-outline:hover { background: rgba(79, 70, 229, 0.1); }

.loader {
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: none;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-wrapper input {
  width: 100%;
  padding-right: 48px;
}
.btn-toggle-eye {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  color: var(--text-muted);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s;
}
.btn-toggle-eye:hover {
  background: rgba(0, 0, 0, 0.05);
}

.toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.9rem;
  transition: 0.3s;
  z-index: 1000;
}
.toast.show { bottom: 30px; }

/* MODAL DE ENCERRAMENTO ANTECIPADO */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-overlay.active {
  display: flex;
  opacity: 1;
}
.modal-box {
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(12px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}
.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}
.modal-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
}
.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
  font-family: 'Outfit', sans-serif;
}
.modal-desc {
  font-size: 0.92rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 20px;
}
.modal-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  font-size: 0.92rem;
  font-family: inherit;
  color: #1e293b;
  resize: vertical;
  min-height: 90px;
  outline: none;
  margin-bottom: 20px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.modal-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.modal-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}
.btn-danger-outline {
  background: transparent;
  color: #dc2626;
  border: 2px solid #dc2626;
  font-weight: 600;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-danger-outline:hover {
  background: #fef2f2;
}
.btn-danger-solid {
  background: #dc2626;
  color: #ffffff;
  border: none;
  font-weight: 600;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
  transition: all 0.2s;
  font-family: inherit;
  font-size: 0.95rem;
}
.btn-danger-solid:hover {
  background: #b91c1c;
}
.btn-neutral {
  background: #f1f5f9;
  color: #475569;
  border: none;
  font-weight: 600;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 0.95rem;
}
.btn-neutral:hover {
  background: #e2e8f0;
}

/* ESTILOS DOS DASHBOARDS (CAMPO & COORDENAÇÃO) */
#dashboard-screen {
  display: none;
  width: 100%;
  max-width: 500px;
  padding: 0 16px 40px 16px;
  transition: max-width 0.3s ease;
}
#dashboard-screen.admin-mode {
  max-width: 1100px;
}

/* 1. MINI-DASHBOARD DO PROFISSIONAL (CAMPO) */
.prof-dash-container {
  margin-bottom: 22px;
  animation: fadeInCard 0.4s ease-out;
}
.prof-dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .prof-dash-grid {
    grid-template-columns: 1fr;
  }
}
.prof-stat-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.prof-stat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.prof-stat-icon {
  font-size: 1.3rem;
  background: #f1f5f9;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}
.prof-stat-info {
  flex: 1;
  min-width: 0;
}
.prof-stat-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.prof-stat-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
}
.prof-stat-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}
.badge-primary {
  background: #e0e7ff;
  color: var(--primary);
}
.badge-team {
  background: #dcfce7;
  color: #15803d;
}
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.fill-primary {
  background: linear-gradient(90deg, var(--primary), #6366f1);
}
.fill-team {
  background: linear-gradient(90deg, #10b981, #059669);
}

/* 2. PAINEL COMPLETO DA COORDENAÇÃO (ADMIN) */
#admin-dashboard-container {
  width: 100%;
  animation: fadeInCard 0.4s ease-out;
}
.dash-admin-header {
  background: #ffffff;
  border-radius: var(--rad);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.dash-main-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-main-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}
.dash-filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.dash-filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-filter-item label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dash-filter-item select {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #1e293b;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}
.dash-filter-item select:focus {
  border-color: var(--primary);
  background: #ffffff;
}
.btn-dash-refresh {
  background: #eef2ff;
  color: var(--primary);
  border: 1.5px solid #c7d2fe;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: inherit;
  height: 38px;
}
.btn-dash-refresh:hover {
  background: #e0e7ff;
  border-color: var(--primary);
  transform: translateY(-1px);
}
.spin {
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}
.dash-sync-badge {
  display: flex;
  justify-content: flex-end;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 0 4px;
}

/* GRID DE KPIS */
.dash-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: 0 3px 12px rgba(0,0,0,0.03);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}
.kpi-purple::before { background: #6366f1; }
.kpi-green::before { background: #10b981; }
.kpi-amber::before { background: #f59e0b; }
.kpi-blue::before { background: #0284c7; }
.kpi-emerald::before { background: #059669; }

.kpi-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-purple .kpi-icon { background: #e0e7ff; }
.kpi-green .kpi-icon { background: #dcfce7; }
.kpi-amber .kpi-icon { background: #fef3c7; }
.kpi-blue .kpi-icon { background: #e0f2fe; }
.kpi-emerald .kpi-icon { background: #d1fae5; }

.kpi-data {
  flex: 1;
  min-width: 0;
}
.kpi-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
  margin-bottom: 4px;
}
.kpi-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}
.kpi-sub {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* SEÇÕES DE DETALHAMENTO */
.dash-sections-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
@media (max-width: 860px) {
  .dash-sections-grid {
    grid-template-columns: 1fr;
  }
}
.dash-section-card {
  background: #ffffff;
  border-radius: var(--rad);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
}
.dash-card-header {
  margin-bottom: 18px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 14px;
}
.dash-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-card-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.dash-card-title p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}
.dash-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.icon-purple { background: #e0e7ff; }
.icon-blue { background: #e0f2fe; }
.icon-amber { background: #fef3c7; }
.icon-emerald { background: #d1fae5; }

/* CARDS DE CADA CAS */
.dash-cas-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cas-item-card {
  background: #f8fafc;
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  transition: background 0.2s;
}
.cas-item-card:hover {
  background: #f1f5f9;
}
.cas-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.cas-item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
}
.cas-item-pct {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--primary);
}
.cas-item-pills {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.cas-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cas-pill-total { background: #e2e8f0; color: #334155; }
.cas-pill-ok { background: #dcfce7; color: #15803d; }
.cas-pill-warn { background: #fee2e2; color: #b91c1c; }
.cas-pill-pend { background: #e0f2fe; color: #0369a1; }

/* LISTA DE PROFISSIONAIS */
.dash-profs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prof-row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.prof-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #818cf8);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.prof-info-block {
  flex: 1;
  min-width: 0;
}
.prof-name-text {
  font-weight: 600;
  font-size: 0.88rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prof-cas-tag {
  font-size: 0.73rem;
  color: var(--text-muted);
}
.prof-metrics-block {
  text-align: right;
}
.prof-metric-val {
  font-weight: 700;
  font-size: 0.92rem;
  color: #0f172a;
}
.prof-metric-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* RANKING DE MOTIVOS */
.dash-motivos-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.motivo-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.motivo-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}
.motivo-count {
  font-weight: 700;
  color: #e11d48;
}
.motivo-bar-bg {
  width: 100%;
  height: 7px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
}
.motivo-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #f43f5e, #fb7185);
}

/* PERFIL CADASTRAL */
.demographics-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.demo-block {
  background: #f8fafc;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
}
.demo-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.unipessoal-bar-box {
  margin-top: 8px;
}
.unipessoal-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.dash-loading-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.dash-empty-state {
  text-align: center;
  padding: 24px 10px;
  color: #94a3b8;
  font-size: 0.85rem;
  font-style: italic;
}

/* ===========================================================
   NOVO MODULO: CONSULTA CADASTRAL
   Classes com prefixo consulta- para isolar o visual das visitas.
   =========================================================== */
#consulta-screen {
  display: none;
  width: 100%;
  max-width: 760px;
  padding: 24px 18px 48px;
  margin: 0 auto;
}
.consulta-hero {
  background: linear-gradient(130deg, #312e81, #4f46e5);
  color: white;
  padding: 27px 26px;
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(79,70,229,.18);
  margin-bottom: 20px;
}
.consulta-hero-top { display: flex; gap: 12px; align-items: center; }
.consulta-hero-icon {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.2);
  width: 46px; height: 46px; border-radius: 14px; font-size: 1.4rem;
  flex-shrink: 0;
}
.consulta-hero h2 { font-size: 1.52rem; line-height: 1.2; }
.consulta-hero p { font-size: .89rem; opacity: .88; margin-top: 6px; line-height: 1.5; }
.consulta-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.consulta-pill {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px; padding: 7px 12px; font-size: .8rem; font-weight: 600;
}
.consulta-card {
  background: white; border: 1px solid #e5e7eb; border-radius: 18px;
  padding: 24px; box-shadow: 0 4px 20px rgba(0,0,0,.04); margin-bottom: 18px;
}
.consulta-card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.consulta-card-emoji {
  background: #eef2ff; width: 40px; height: 40px; border-radius: 12px;
  display: flex; justify-content: center; align-items: center; font-size: 1.25rem;
}
.consulta-card h3 { font-size: 1.13rem; color: #1e293b; }
.consulta-caption { font-size: .84rem; color: #64748b; margin-top: 4px; line-height: 1.45; }
.consulta-label {
  display: block; font-size: .85rem; font-weight: 700;
  color: #334155; margin-bottom: 8px;
}
.consulta-input-row { display: flex; gap: 10px; }
.consulta-cpf-input {
  min-width: 0; width: 100%; flex: 1; padding: 14px 15px;
  border: 1.5px solid #cbd5e1; border-radius: 12px;
  font-family: inherit; font-size: 1rem; color: #0f172a;
  outline: none; background: white;
}
.consulta-cpf-input:focus {
  border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.10);
}
.consulta-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px 22px; border: none; border-radius: 12px;
  background: #4f46e5; color: white; font-family: inherit;
  font-size: .95rem; font-weight: 700; cursor: pointer;
  transition: background .2s, opacity .2s;
}
.consulta-button:hover:not(:disabled) { background: #4338ca; }
.consulta-button:disabled { opacity: .55; cursor: not-allowed; }
.consulta-button-success { background: #059669; width: 100%; margin-top: 18px; }
.consulta-button-success:hover:not(:disabled) { background: #047857; }
.consulta-msg {
  display: none; margin-top: 14px; padding: 12px 14px;
  border-radius: 11px; font-size: .88rem; line-height: 1.4;
  border: 1px solid transparent;
}
.consulta-msg.info { display: block; background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.consulta-msg.error { display: block; background: #fff1f2; color: #9f1239; border-color: #fecdd3; }
.consulta-msg.ok { display: block; background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.consulta-found {
  display: flex; align-items: center; gap: 8px; color: #047857;
  font-size: .87rem; font-weight: 700; margin: 0 0 18px;
}
.consulta-detail-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px; margin-bottom: 2px;
}
.consulta-detail {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 12px 14px; min-width: 0;
}
.consulta-detail.wide { grid-column: span 2; }
.consulta-detail-label {
  display: block; color: #64748b; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .35px; margin-bottom: 5px;
}
.consulta-detail-value { font-size: .92rem; font-weight: 600; color: #1e293b; overflow-wrap: anywhere; }
.consulta-question { margin: 22px 0 13px; font-size: .96rem; font-weight: 700; color: #1e293b; }
.consulta-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.consulta-option {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  padding: 14px 10px; border-radius: 12px; background: white;
  border: 2px solid #cbd5e1; cursor: pointer; font-weight: 700; color: #475569;
}
.consulta-option input { accent-color: #4f46e5; width: 17px; height: 17px; }
.consulta-option:has(input:checked) { border-color: #4f46e5; background: #eef2ff; color: #3730a3; }
.consulta-footnote { font-size: .78rem; color: #64748b; line-height: 1.5; text-align: center; }
@media (max-width: 550px) {
  #consulta-screen { padding: 14px 12px 35px; }
  .consulta-hero { padding: 21px 18px; }
  .consulta-card { padding: 18px 16px; }
  .consulta-input-row { flex-direction: column; }
  .consulta-input-row .consulta-button { width: 100%; }
  .consulta-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .consulta-detail.wide { grid-column: auto; }
}

/* ========================================================
   ESTILOS DO MÓDULO DE AGENDAMENTO DE VISITAS
   ======================================================== */
#agendamento-screen {
  display: none;
  width: 100%;
  max-width: 680px;
  padding: 24px 16px 50px;
  margin: 0 auto;
}
.alerta-box {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 0.9rem;
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alerta-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1.5px solid #fecdd3;
  font-weight: 500;
}
.alerta-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1.5px solid #fef3c7;
  font-weight: 500;
}
.alerta-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1.5px solid #bfdbfe;
}
.agendamento-datas-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.data-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.data-card-item:hover:not(.esgotado) {
  border-color: #818cf8;
  background: #f8fafc;
}
.data-card-item.selected {
  border-color: var(--primary);
  background: #eef2ff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
}
.data-card-item.esgotado {
  opacity: 0.55;
  background: #f1f5f9;
  cursor: not-allowed;
  border-color: #e2e8f0;
}
.data-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.data-card-left input[type="radio"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.data-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
}
.data-card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.data-card-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-vagas-ok {
  background: #dcfce7;
  color: #15803d;
}
.badge-vagas-alerta {
  background: #fef3c7;
  color: #b45309;
}
.badge-vagas-zero {
  background: #fee2e2;
  color: #b91c1c;
}
.btn-logout-small {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout-small:hover {
  background: rgba(255, 255, 255, 0.3);
}
.btn-admin-nav {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-admin-nav:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* ==========================================================================
   ESTILOS: MONTAGEM DE ROTAS E AGENDAMENTO EM LOTE
   ========================================================================== */
.agendamento-params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.agendamento-param-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.consulta-select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1e293b;
  background-color: #ffffff;
  transition: all 0.2s ease;
  outline: none;
  cursor: pointer;
}
.consulta-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Banner de Capacidade e Vagas */
.capacidade-banner {
  margin-top: 20px;
  background: linear-gradient(135deg, #f8fafc, #eff6ff);
  border: 1.5px solid #dbeafe;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.capacidade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.capacidade-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.capacidade-titulo {
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
}
.capacidade-detalhe {
  font-size: 0.82rem;
  color: #64748b;
}
.capacidade-badge {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.capacidade-badge.cheio {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}
.capacidade-progress-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
}
.capacidade-progress-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s ease, background 0.3s ease;
}
.capacidade-progress-fill.quase-cheio {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}
.capacidade-progress-fill.lotado {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}
.capacidade-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

/* Tabela da Fila da Rota */
.tabela-fila-container {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-top: 12px;
  background: #ffffff;
}
.tabela-fila {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}
.tabela-fila th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.tabela-fila td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}
.tabela-fila tbody tr:hover {
  background: #f8fafc;
}
.btn-remover-item {
  background: transparent;
  color: #ef4444;
  border: 1px solid #fecaca;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}
.btn-remover-item:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}
.btn-limpar-fila {
  background: transparent;
  color: #64748b;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-limpar-fila:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}
.fila-vazia-mensagem {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
}
.fila-vazia-icone {
  font-size: 2.5rem;
  margin-bottom: 8px;
}
.fila-vazia-texto {
  font-size: 1rem;
  font-weight: 700;
  color: #475569;
}
.fila-vazia-sub {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 4px;
}

.btn-refresh-link {
  background: transparent;
  border: none;
  color: #4f46e5;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-refresh-link:hover {
  background: #eef2ff;
  color: #4338ca;
}


