/* ======================================================
   GLOBAL
====================================================== */

body, html {
  margin: 0;
  padding: 0;
  background-color: #f4f6fb;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Mantém ajuste de texto consistente em browsers mobile */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ======================================================
   MODAL CENTRAL (CALENDÁRIO) - mesmo padrão visual do
   modal de detalhes do agendamento (agenda-day-modal)
====================================================== */

.calendar-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.calendar-sidebar-panel {
  width: min(860px, 96vw);
  max-height: min(80vh, 720px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendar-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid #eef2f7;
}

.calendar-sidebar-title {
  flex: 1;
  font-weight: 800;
  font-size: 14px;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-sidebar-back,
.calendar-sidebar-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 18px;
  cursor: pointer;
  color: #111827;
  line-height: 1;
}

.calendar-sidebar-back:hover,
.calendar-sidebar-close:hover {
  background: #f3f4f6;
}

.calendar-sidebar-body {
  padding: 14px 14px 18px;
  overflow: auto;
}

/* Botão X "flutuante" (visível no passo do formulário).
   Posicionado para alinhar com o canto superior direito do
   modal centralizado dos formulários. */
.calendar-form-close-fab {
  position: fixed;
  top: max(16px, calc(50vh - min(45vh, 410px) + 8px));
  right: max(16px, calc(50vw - min(48vw, 490px) + 8px));
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #111827;
  z-index: 999;
  display: none;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
}

.calendar-form-close-fab:hover {
  background: #f3f4f6;
}

#app-shell.sidebar-open.sidebar-step-form .calendar-form-close-fab {
  display: block;
}

#app-shell.sidebar-open.sidebar-step-form .calendar-sidebar-panel {
  /* no passo do form, escondemos o painel de seleção e deixamos só o overlay + X */
  display: none;
}

/* Quando a sidebar está aberta, colocamos os cards de formulário
   centralizados na tela (mesmo padrão do modal de detalhes). */
#app-shell.sidebar-open #nova-visita-card,
#app-shell.sidebar-open #vistoria-card,
#app-shell.sidebar-open #repasse-card,
#app-shell.sidebar-open #complemento-card,
#app-shell.sidebar-open #manutencao-card,
#app-shell.sidebar-open #recolher-pagamento-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(980px, 96vw);
  max-height: min(90vh, 820px);
  margin: 0;
  border-radius: 14px;
  overflow: auto;
  z-index: 260;
  display: none;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  background: #ffffff;
}

#app-shell.sidebar-open.sidebar-tipo-servico #nova-visita-card { display: block !important; }
#app-shell.sidebar-open.sidebar-status-a-confirmar.sidebar-tipo-servico #nova-visita-card { display: block !important; }
#app-shell.sidebar-open.sidebar-tipo-vistoria #vistoria-card { display: block !important; }
#app-shell.sidebar-open.sidebar-tipo-repasse #repasse-card { display: block !important; }
#app-shell.sidebar-open.sidebar-tipo-complemento #complemento-card { display: block !important; }
#app-shell.sidebar-open.sidebar-tipo-manutencao #manutencao-card { display: block !important; }
#app-shell.sidebar-open.sidebar-tipo-recolher_pagamento #recolher-pagamento-card { display: block !important; }

#app-shell.sidebar-open.sidebar-multi #agenda-sidebar-only-forms {
  position: fixed;
  top: 5vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(980px, 96vw);
  max-height: 90vh;
  overflow: auto;
  z-index: 260;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#app-shell.sidebar-open.sidebar-multi #nova-visita-card,
#app-shell.sidebar-open.sidebar-multi #vistoria-card,
#app-shell.sidebar-open.sidebar-multi #repasse-card,
#app-shell.sidebar-open.sidebar-multi #complemento-card,
#app-shell.sidebar-open.sidebar-multi #manutencao-card,
#app-shell.sidebar-open.sidebar-multi #recolher-pagamento-card {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
  max-height: none;
  overflow: visible;
  margin: 0;
}

#app-shell.sidebar-open.sidebar-multi #nova-visita-card {
  display: block !important;
}

#app-shell.sidebar-open.sidebar-multi #vistoria-card,
#app-shell.sidebar-open.sidebar-multi #repasse-card,
#app-shell.sidebar-open.sidebar-multi #complemento-card,
#app-shell.sidebar-open.sidebar-multi #manutencao-card,
#app-shell.sidebar-open.sidebar-multi #recolher-pagamento-card {
  display: none !important;
}

#app-shell.sidebar-open.sidebar-multi.sidebar-tipo-repasse #repasse-card,
#app-shell.sidebar-open.sidebar-multi.sidebar-tipo-complemento #complemento-card,
#app-shell.sidebar-open.sidebar-multi.sidebar-tipo-manutencao #manutencao-card {
  display: block !important;
}

#app-shell.sidebar-open.sidebar-multi #repasse-card .nova-visita-actions,
#app-shell.sidebar-open.sidebar-multi #complemento-card .nova-visita-actions,
#app-shell.sidebar-open.sidebar-multi #manutencao-card .nova-visita-actions {
  display: none !important;
}

#app-shell.sidebar-open.sidebar-multi #repasse-card #repasse-data-item,
#app-shell.sidebar-open.sidebar-multi #repasse-card #repasse-horario-item,
#app-shell.sidebar-open.sidebar-multi #repasse-card #repasse-qtd-horarios-item,
#app-shell.sidebar-open.sidebar-multi #repasse-card #repasse-detetizador-item,
#app-shell.sidebar-open.sidebar-multi #repasse-card #repasse-pragas-item,
#app-shell.sidebar-open.sidebar-multi #repasse-card #repasse-manual-fields-wrap,
#app-shell.sidebar-open.sidebar-multi #complemento-card #complemento-data-item,
#app-shell.sidebar-open.sidebar-multi #complemento-card #complemento-horario-item,
#app-shell.sidebar-open.sidebar-multi #complemento-card #complemento-qtd-horarios-item,
#app-shell.sidebar-open.sidebar-multi #complemento-card #complemento-detetizador-item,
#app-shell.sidebar-open.sidebar-multi #complemento-card #complemento-pragas-item,
#app-shell.sidebar-open.sidebar-multi #complemento-card #complemento-manual-fields-wrap,
#app-shell.sidebar-open.sidebar-multi #manutencao-card #manutencao-data-item,
#app-shell.sidebar-open.sidebar-multi #manutencao-card #manutencao-horario-item,
#app-shell.sidebar-open.sidebar-multi #manutencao-card #manutencao-qtd-horarios-item,
#app-shell.sidebar-open.sidebar-multi #manutencao-card #manutencao-detetizador-item,
#app-shell.sidebar-open.sidebar-multi #manutencao-card #manutencao-manual-fields-wrap {
  display: none !important;
}

.appointment-type-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}

/* Cards que só existem na Agenda para o drawer (evita aparecerem no layout normal) */
#agenda-sidebar-only-forms > * {
  display: none;
}



/* ======================================================
 NAVBAR
====================================================== */

.top-nav {
  width: 100%;
  height: 68px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0px 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-img {
  height: 42px;
  width: 42px;
  object-fit: cover;
  border-radius: 6px;
}

.logo-title {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

.nav-right {
  display: flex;
  gap: 18px;
}

.nav-link {
  text-decoration: none;
  color: #475569;
  font-size: 15px;
  padding: 6px 10px;
  transition: 0.15s;
  border-radius: 6px;
}

.nav-link:hover {
  color: #2563eb;
  background-color: #eff6ff;
}

.nav-link.active {
  color: #2563eb !important;
  font-weight: 600;
}


/* ======================================================
 PAGE CONTENT WRAPPER
====================================================== */

.page-content {
  flex: 1;
  padding: 32px 72px;
}


/* ======================================================
 SECTION HEADERS
====================================================== */

.page-header h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  color: #1e293b;
}

.page-subtitle {
  margin-top: 6px;
  color: #64748b;
  font-size: 15px;
}

.detetizadores-page .agenda-table-container {
  margin-top: 24px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.03);
  padding: 18px 20px 20px;
}

.detetizadores-page .agenda-table-container h3 {
  margin: 0 0 4px;
  color: #111827;
}

.detetizadores-page .agenda-table-container .page-subtitle {
  margin: 0 0 14px;
}

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

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

.detetizadores-table th,
.detetizadores-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: middle;
}

.detetizadores-table th {
  background: #f8fafc;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}

.detetizadores-col-select {
  width: 64px;
}

.detetizadores-col-name {
  min-width: 180px;
  font-weight: 700;
  color: #111827;
}

.detetizadores-row-select label {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.detetizadores-row-select input {
  margin: 0;
}

.detetizadores-status-dropdown {
  min-width: 180px;
}

.detetizadores-date-picker,
.detetizadores-date-picker .SingleDatePicker,
.detetizadores-date-picker .SingleDatePickerInput,
.detetizadores-date-picker .DateInput {
  width: 100%;
}

.detetizadores-date-picker .DateInput_input {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  height: 38px;
  padding: 8px 10px;
  font-size: 13px;
  box-sizing: border-box;
}

.detetizadores-empty {
  padding: 14px 0;
  color: #6b7280;
  font-size: 13px;
}


/* ======================================================
 KPI CARDS
====================================================== */

.kpi-row {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.kpi-card {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-title {
  color: #475569;
  font-size: 14px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
}

.kpi-blue { color: #2563eb; }
.kpi-green { color: #16a34a; }

.kpi-icon {
  margin-top: 4px;
  font-size: 20px;
  color: #2563eb;
}

.kpi-trend {
  color: #16a34a;
}


/* ======================================================
 EXPORTAR ATENDIMENTOS DO DIA (HOME)
====================================================== */

.home-export-section {
  margin-top: 24px;
}

.home-export-card {
  background: white;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-export-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
}

.home-export-periodo {
  display: flex;
  gap: 18px;
}

.home-export-periodo-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
}

.home-export-periodo-input {
  cursor: pointer;
}

.home-export-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.home-export-period-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-export-mes-dropdown {
  min-width: 160px;
}

.home-export-ano-input {
  width: 110px;
}

.home-export-message {
  font-size: 14px;
}

.home-export-message .home-export-success {
  color: #16a34a;
}

.home-export-message .home-export-error {
  color: #dc2626;
}


/* ======================================================
 QUICK ACCESS CARDS
====================================================== */

.section-title {
  margin-top: 32px;
  font-size: 22px;
  font-weight: 600;
  color: #1e293b;
}

.quick-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.quick-card {
  background: white;
  border-radius: 14px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.04);
}

.quick-header {
  display: flex;
  gap: 12px;
}

.quick-icon {
  font-size: 28px;
}

.quick-header-text {
  display: flex;
  flex-direction: column;
}

.quick-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.quick-description {
  color: #6b7280;
  font-size: 14px;
}

.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 8px;
  width: fit-content;
}

.badge-blue {
  background-color: #dbeafe;
  color: #1e40af;
}

.badge-gray {
  background-color: #e5e7eb;
  color: #374151;
}


/* ======================================================
 BUTTONS
====================================================== */

.primary-button,
.secondary-button {
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: 0.15s;
  font-weight: 600;
}

.primary-button {
  background-color: #2563eb;
  color: white;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
}

.primary-button:hover {
  background-color: #1e4ed8;
}

.secondary-button {
  background-color: #f3f4f6;
  color: #1e293b;
}

.secondary-button:hover {
  background-color: #e2e8f0;
}


/* ======================================================
 RESPONSIVE
====================================================== */

@media (max-width: 900px) {
  .page-content {
      padding: 20px;
  }

  .kpi-row,
  .quick-row {
      grid-template-columns: 1fr;
  }
}

/* Mobile (celular) */
@media (max-width: 600px) {
  .top-nav {
    padding: 0 14px;
    gap: 10px;
  }

  .logo-title {
    display: none;
  }

  .nav-right {
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .nav-link {
    font-size: 14px;
    padding: 6px 8px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .page-subtitle {
    font-size: 14px;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  /* Modais em tela cheia no celular */
  .calendar-sidebar-backdrop {
    padding: 0;
  }

  .calendar-sidebar-panel {
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  #app-shell.sidebar-open #nova-visita-card,
  #app-shell.sidebar-open #vistoria-card,
  #app-shell.sidebar-open #repasse-card,
  #app-shell.sidebar-open #complemento-card,
  #app-shell.sidebar-open #manutencao-card,
  #app-shell.sidebar-open #recolher-pagamento-card {
    top: 0;
    left: 0;
    transform: none;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .calendar-form-close-fab {
    top: 16px;
    right: 12px;
  }
}

/* Busca unificada — estilos principais em assets/followup.css */
.followup-search-item {
  margin-bottom: 4px;
}

.agenda-tooltip-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
  margin: 8px 0 6px;
}
