/* assets/css/app.css - Congrega+ UX/UI Avançada Compacta (Mobile PWA & Desktop Widescreen) */

:root {
  /* Paleta Principal & Semântica */
  --primary: #1e3a8a;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --secondary: #0f766e;
  --secondary-hover: #115e59;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-elevated: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  /* Status Semânticos */
  --status-safe: #16a34a;
  --status-safe-bg: #dcfce7;
  --status-safe-text: #166534;
  --status-danger: #dc2626;
  --status-danger-bg: #fee2e2;
  --status-danger-text: #991b1b;
  --status-warning: #d97706;
  --status-warning-bg: #fef3c7;
  --status-warning-text: #92400e;
  --status-info: #0284c7;
  --status-info-bg: #e0f2fe;
  --status-info-text: #075985;
  --status-purple: #7c3aed;
  --status-purple-bg: #f3e8ff;
  --status-purple-text: #6b21a8;

  /* Tipografia Compacta e Legível (RNF-04) */
  --base-font-size: 15px;
  --title-font-size: 1.15rem;
  --heading-font-size: 1.35rem;
  --small-font-size: 0.82rem;
  --xs-font-size: 0.72rem;

  /* Raios e Sombras Sutis */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 3px 10px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 20px -3px rgba(0, 0, 0, 0.07);
  --shadow-xl: 0 16px 28px -8px rgba(0, 0, 0, 0.12);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modificadores de Acessibilidade: Tamanho de Fonte (RNF-04) */
body.font-sm {
  --base-font-size: 13.5px;
  --title-font-size: 1.05rem;
  --heading-font-size: 1.25rem;
  --small-font-size: 0.75rem;
  --xs-font-size: 0.68rem;
}
body.font-md {
  --base-font-size: 15px;
  --title-font-size: 1.15rem;
  --heading-font-size: 1.35rem;
  --small-font-size: 0.82rem;
  --xs-font-size: 0.72rem;
}
body.font-lg {
  --base-font-size: 18px;
  --title-font-size: 1.35rem;
  --heading-font-size: 1.6rem;
  --small-font-size: 0.95rem;
  --xs-font-size: 0.82rem;
}
body.font-xl {
  --base-font-size: 21px;
  --title-font-size: 1.55rem;
  --heading-font-size: 1.9rem;
  --small-font-size: 1.15rem;
  --xs-font-size: 0.95rem;
}

/* Modo Escuro & Alto Contraste Acessível (RNF-04) - WCAG AAA */
body.high-contrast {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #1e293b;
  --primary-border: #60a5fa;
  --secondary: #14b8a6;
  --secondary-hover: #0d9488;

  --bg-main: #0b0f19;
  --bg-card: #151e2e;
  --bg-subtle: #1e293b;
  --bg-elevated: #1e293b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --border-color: #334155;
  --border-light: #1e293b;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.7);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.8);
}

body.high-contrast button,
body.high-contrast input,
body.high-contrast select,
body.high-contrast textarea,
body.high-contrast .card,
body.high-contrast .ministry-compact-card,
body.high-contrast .meeting-compact-card,
body.high-contrast .top-bar,
body.high-contrast .desktop-nav,
body.high-contrast .bottom-nav,
body.high-contrast .modal-box {
  border-color: #334155;
}

body.high-contrast .btn-primary {
  background-color: #2563eb !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}

body.high-contrast .btn-outline {
  border-color: #475569 !important;
  color: #e2e8f0 !important;
}
body.high-contrast .btn-outline:hover {
  background-color: #1e293b !important;
  border-color: #64748b !important;
}

body.high-contrast .role-badge {
  border: 1px solid #475569;
}

/* Reset e Base Geral */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

*, *::before, *::after {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--base-font-size);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.45;
  user-select: text;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* Tipografia Equilibrada e Suave */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
}
strong, b {
  font-weight: 600;
}

/* Ajuste de Padding e Safe Areas por Dispositivo */
@media (max-width: 767px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 10px));
  }
}
@media (min-width: 768px) {
  body {
    padding-bottom: 24px;
  }
}

/* Prevenção de Zoom Involuntário no iOS Safari */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* Alvos de Toque Acessíveis e Compactos */
button, input, select, textarea, a.btn-touch {
  min-height: 40px;
  font-size: var(--base-font-size);
  font-family: inherit;
  touch-action: manipulation;
}

/* Top App Bar Header (com Safe Area no topo) */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: calc(6px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 16px)) 6px max(16px, env(safe-area-inset-left, 16px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-title {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  letter-spacing: -0.3px;
  text-decoration: none;
}
body.high-contrast .top-bar-title {
  color: #ffffff;
}

/* Navegação Desktop (Visível em telas amplas >= 768px) */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  max-width: 720px;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
  }
}

.desktop-nav .nav-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.84rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 36px;
  white-space: nowrap;
}

.desktop-nav .nav-item:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.desktop-nav .nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
body.high-contrast .desktop-nav .nav-item.active {
  background-color: #2563eb;
  color: #ffffff;
}

.desktop-nav .nav-icon svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* Controles de Acessibilidade */
.accessibility-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.acc-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  font-weight: 500;
  cursor: pointer;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: background var(--transition-fast);
}
.acc-btn:hover {
  background: #e2e8f0;
}
.acc-label {
  font-size: 0.74rem;
  display: none;
}
@media (min-width: 640px) {
  .acc-label {
    display: inline;
  }
}

/* Barra de Perfil e Informações do Usuário */
.user-bar {
  background: #f0f7ff;
  border-bottom: 1px solid var(--primary-border);
  padding: 6px max(12px, env(safe-area-inset-right, 12px)) 6px max(12px, env(safe-area-inset-left, 12px));
  font-size: var(--small-font-size);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all var(--transition-fast);
}

@media (min-width: 768px) {
  .user-bar {
    padding: 6px 20px;
  }
}

body.high-contrast .user-bar {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
}

.user-info-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-actions-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Badges e Pílulas */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--primary);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1px;
}

/* Container Principal do Aplicativo */
.app-container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 14px;
  transition: padding var(--transition-fast);
}

@media (min-width: 768px) {
  .app-container {
    padding: 18px 20px;
  }
}

/* Layout Horizontal e Vertical do Dashboard (RF-15 / Geral) */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 880px) {
  .dashboard-layout {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
    gap: 16px;
  }
}

.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

/* Grids Responsivos Compactos */
.grid-responsive-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 768px) {
  .grid-responsive-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.grid-responsive-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .grid-responsive-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .grid-responsive-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

/* Cartões Compactos e Modernos */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 13px 15px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

@media (min-width: 768px) {
  .card {
    padding: 15px 18px;
    margin-bottom: 14px;
  }
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-compact {
  padding: 10px 14px;
}

.card-title {
  font-size: var(--title-font-size);
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Botões Compactos */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-size: var(--small-font-size);
  transition: all var(--transition-fast);
  user-select: none;
  min-height: 38px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(30, 58, 138, 0.2);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 3px 8px rgba(30, 58, 138, 0.3);
}

.btn-success {
  background-color: var(--status-safe);
  color: #ffffff;
}
.btn-success:hover {
  background-color: #15803d;
}

.btn-danger {
  background-color: var(--status-danger);
  color: #ffffff;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: var(--bg-subtle);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 4px 10px;
  min-height: 30px;
  font-size: var(--xs-font-size);
}

.btn-block {
  width: 100%;
}

/* Campos de Formulário Compactos */
.form-group {
  margin-bottom: 10px;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  font-size: var(--small-font-size);
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: var(--base-font-size);
  min-height: 38px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Banner de Alerta de Catástrofe (RF-10) */
.disaster-alert-banner {
  background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  margin-bottom: 12px;
  box-shadow: 0 4px 15px rgba(185, 28, 28, 0.3);
  animation: pulse-danger 2s infinite;
}
@keyframes pulse-danger {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Status das Residências no Território (RF-06) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1px;
}
.status-regular { background: #dcfce7; color: #166534; }
.status-do_not_call { background: #fee2e2; color: #991b1b; }
.status-moved { background: #f1f5f9; color: #475569; }
.status-speak_to_responsible { background: #e0f2fe; color: #0369a1; }
.status-revisit { background: #fef3c7; color: #92400e; }
.status-busy { background: #f3e8ff; color: #6b21a8; }
.status-bible_study { background: #dbeafe; color: #1e40af; }
.status-no_language_resident { background: #f1f5f9; color: #64748b; }

/* Barra de Navegação Inferior Fluida (Mobile Native Tab Bar) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(58px + env(safe-area-inset-bottom, 8px));
  padding-bottom: env(safe-area-inset-bottom, 8px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 1000;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.bottom-nav::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none !important;
  }
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  flex: 1 0 64px;
  min-width: 64px;
  max-width: 92px;
  height: 100%;
  padding: 4px 6px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.bottom-nav .nav-item span:not(.nav-icon) {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.bottom-nav .nav-item:active {
  transform: scale(0.92);
}

.bottom-nav .nav-item.active {
  color: var(--primary);
  font-weight: 700;
}
body.high-contrast .bottom-nav .nav-item.active {
  color: #60a5fa;
}

.bottom-nav .nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 3px;
}

.bottom-nav .nav-icon svg {
  width: 20px;
  height: 20px;
}

/* Tabelas e Wrappers Responsivos Compactos (RF-02) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  margin-bottom: 10px;
}

.s21-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  margin-bottom: 10px;
}

.s21-table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--small-font-size);
}
.s21-table th, .s21-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
}
.s21-table th {
  background-color: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-main);
  position: sticky;
  top: 0;
  z-index: 5;
}
.s21-table tbody tr:nth-child(even) {
  background-color: rgba(248, 250, 252, 0.7);
}
body.high-contrast .s21-table th {
  background-color: #18181b;
}

/* Mapa Leaflet */
#territoryMap {
  width: 100%;
  height: 340px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  z-index: 10;
  border: 1px solid var(--border-color);
}
@media (min-width: 768px) {
  #territoryMap {
    height: 420px;
  }
}

/* Modais Aperfeiçoados (Bottom-Sheet no Mobile, Centrado no Desktop) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  animation: fadeIn 0.18s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  position: relative;
  animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal-box {
    max-width: 100%;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    max-height: calc(100dvh - 24px);
    animation: slideUpSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .modal-box .sheet-indicator {
    display: block !important;
  }
  .modal-content-inner {
    padding: 14px 16px;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
    -webkit-overflow-scrolling: touch;
  }
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-content-inner {
  padding: 16px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Alerta de Conexão Offline */
.offline-indicator {
  display: none;
  background: #b45309;
  color: #ffffff;
  padding: 6px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
}
body.is-offline .offline-indicator {
  display: block;
}

/* Spinner de Carregamento Suave */
.loading-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text-muted);
}
.loading-spinner::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Desenhador Visual de Polígonos de Territórios (Modal Amplo & Tela Cheia) */
.drawer-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.drawer-modal-box {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 1100px;
  height: 86vh;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  position: relative;
  transition: width 0.2s, height 0.2s, max-width 0.2s, max-height 0.2s;
}

.drawer-modal-box.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  z-index: 6000 !important;
}

.drawer-header-bar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 640px) {
  .drawer-modal-backdrop {
    padding: 0;
  }
  .drawer-modal-box {
    border-radius: 0;
    height: 100vh;
    max-height: 100vh;
    max-width: 100vw;
  }
}

/* Painéis de Reunião Ultracompactos (Visão One-Page) */
.meetings-onepage-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}
@media (min-width: 860px) {
  .meetings-onepage-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.meeting-compact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.meeting-compact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-fast);
}
.meeting-compact-header:hover {
  background: var(--bg-subtle);
}

.meeting-compact-body {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.meeting-part-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 0.8rem;
  line-height: 1.25;
  transition: background-color var(--transition-fast);
}
.meeting-part-row:hover {
  background: var(--bg-subtle);
}
.meeting-part-row.is-mine {
  background: #f0fdf4;
  border-color: #86efac;
}
.meeting-part-row.is-unassigned {
  background: #f8fafc;
  border-color: #cbd5e1;
}
body.high-contrast .meeting-part-row.is-unassigned {
  background: #1e293b;
  border-color: #475569;
}

.meeting-song-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Painel do Ministério Ultracompacto (Visão One-Page) */
.ministry-compact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.ministry-compact-card .card-title {
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.s21-compact-wrapper {
  max-height: 290px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
}
.s21-compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  min-width: 320px;
}
.s21-compact-table th, .s21-compact-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-color);
  line-height: 1.25;
}
.s21-compact-table th {
  background-color: var(--bg-subtle);
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
}
.s21-compact-table tfoot td {
  background-color: var(--bg-subtle);
  font-weight: 600;
  position: sticky;
  bottom: 0;
  z-index: 2;
}
.s21-compact-table tbody tr:nth-child(even) {
  background-color: rgba(248, 250, 252, 0.7);
}
body.high-contrast .s21-compact-table th,
body.high-contrast .s21-compact-table tfoot td {
  background-color: #1e293b;
  color: #f8fafc;
}

/* Barra em Destaque de Emergência / Ajuda Humanitária no Cabeçalho (RF-10) */
.emergency-header-bar {
  background: linear-gradient(135deg, #991b1b 0%, #b91c1c 50%, #7f1d1d 100%);
  color: #ffffff;
  padding: 8px 16px;
  box-shadow: 0 3px 12px rgba(185, 28, 28, 0.35);
  border-bottom: 2px solid #ef4444;
  position: relative;
  z-index: 90;
  animation: pulse-emergency-bar 3s infinite ease-in-out;
}
@keyframes pulse-emergency-bar {
  0% { box-shadow: 0 2px 8px rgba(185, 28, 28, 0.3); }
  50% { box-shadow: 0 4px 18px rgba(239, 68, 68, 0.55); }
  100% { box-shadow: 0 2px 8px rgba(185, 28, 28, 0.3); }
}

.emergency-bar-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.emergency-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 260px;
}

.emergency-bar-badge {
  background: #ffffff;
  color: #991b1b;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.emergency-bar-text {
  font-size: 0.84rem;
  line-height: 1.35;
  color: #ffffff;
}

.emergency-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.emergency-btn-action {
  background: #ffffff;
  color: #991b1b;
  border: 1px solid #ffffff;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
}
.emergency-btn-action:hover {
  background: #fee2e2;
  transform: translateY(-1px);
}

.emergency-btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-weight: 500;
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 32px;
}
.emergency-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   TELA INICIAL / DASHBOARD - DESIGN SYSTEM MODERNO & HIERÁRQUICO (v1.3.8)
   ========================================================================== */

.home-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.home-hero-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.home-hero-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.home-report-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}
.home-report-pill.pending {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.home-report-pill.pending:hover {
  background: #fde68a;
  transform: translateY(-1px);
}
.home-report-pill.submitted {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.home-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.home-section-title h2 {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Grid de Reuniões Semanais */
.home-meetings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

@media (min-width: 680px) {
  .home-meetings-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

.home-meeting-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.home-meeting-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.home-meeting-card.midweek {
  border-top: 3px solid #2563eb;
}

.home-meeting-card.weekend {
  border-top: 3px solid #0f766e;
}

.home-meeting-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 8px;
}

.home-meeting-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.home-meeting-tag.midweek {
  background: #eff6ff;
  color: #1e40af;
}
.home-meeting-tag.weekend {
  background: #f0fdf4;
  color: #115e59;
}

.home-meeting-datetime {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  margin-top: 4px;
}

.home-meeting-theme {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Box Integrado do Discurso Público dentro da Reunião de Fim de Semana */
.home-talk-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  margin: 10px 0;
}

.home-talk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 6px;
}

.home-talk-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.home-talk-speaker {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.home-talk-hospitality {
  font-size: 0.73rem;
  color: #4338ca;
  background: #eef2ff;
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  margin-top: 5px;
  display: inline-block;
}

/* Linha de Limpeza Integrada */
.home-cleaning-row {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
}

.home-cleaning-groups {
  font-weight: 600;
  color: #047857;
}

.home-your-group-badge {
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* Card de Saídas de Campo & Limpeza Geral */
.home-activity-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.home-schedule-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  margin-bottom: 6px;
  transition: background var(--transition-fast);
}
.home-schedule-item:last-child {
  margin-bottom: 0;
}
.home-schedule-item.my-group {
  border-left: 3px solid #16a34a;
}

/* Modo Escuro / Alto Contraste */
body.high-contrast .home-meeting-card {
  background: var(--bg-card);
  border-color: #334155;
}
body.high-contrast .home-meeting-tag.midweek {
  background: #1e3a8a;
  color: #93c5fd;
}
body.high-contrast .home-meeting-tag.weekend {
  background: #064e3b;
  color: #6ee7b7;
}
body.high-contrast .home-talk-box {
  background: #1e293b;
  border-color: #334155;
}
body.high-contrast .home-talk-hospitality {
  background: #312e81;
  color: #c7d2fe;
}
body.high-contrast .home-schedule-item {
  background: #1e293b;
  border-color: #334155;
}
body.high-contrast .home-cleaning-groups {
  color: #34d399;
}
body.high-contrast .home-your-group-badge {
  background: #064e3b;
  color: #6ee7b7;
}
body.high-contrast .home-report-pill.pending {
  background: #78350f;
  color: #fde68a;
  border-color: #b45309;
}
body.high-contrast .home-report-pill.submitted {
  background: #064e3b;
  color: #86efac;
  border-color: #059669;
}

/* Painéis Ocultáveis do Banco de Oradores (v1.3.9) */
.speaker-collapsible-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  overflow: hidden;
  margin-bottom: 8px;
}
.speaker-collapsible-card:hover {
  border-color: #cbd5e1;
}
.speaker-card-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-card);
  transition: background var(--transition-fast);
}
.speaker-card-header:hover {
  background: var(--bg-subtle);
}
.speaker-outlines-panel {
  border-top: 1px solid var(--border-color);
  padding: 10px 14px;
  background: var(--bg-subtle);
  transition: all var(--transition-fast);
}
body.high-contrast .speaker-collapsible-card {
  background: var(--bg-card);
  border-color: #334155;
}
body.high-contrast .speaker-card-header {
  background: var(--bg-card);
}
body.high-contrast .speaker-card-header:hover {
  background: #1e293b;
}
body.high-contrast .speaker-outlines-panel {
  background: #0f172a;
  border-color: #334155;
}

/* Escala de Discursos Compacta e Visual (v1.4.3) */
.talk-schedule-compact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 6px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.talk-schedule-compact-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: #cbd5e1;
}
.talk-schedule-compact-card.inbound {
  border-left: 4px solid #0284c7;
}
.talk-schedule-compact-card.outbound {
  border-left: 4px solid #7c3aed;
}
.talk-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  width: 48px;
  height: 52px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  text-align: center;
}
.talk-schedule-compact-card.inbound .talk-date-badge {
  background: #f0f9ff;
  border-color: #bae6fd;
}
.talk-schedule-compact-card.outbound .talk-date-badge {
  background: #f5f3ff;
  border-color: #ddd6fe;
}
.talk-date-day {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
}
.talk-schedule-compact-card.inbound .talk-date-day {
  color: #0369a1;
}
.talk-schedule-compact-card.outbound .talk-date-day {
  color: #6d28d9;
}
.talk-date-month {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-top: 1px;
}
.talk-content-flow {
  flex: 1;
  min-width: 0;
}
.talk-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.3;
}
.talk-title-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}
.talk-number-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
}
.talk-schedule-compact-card.inbound .talk-number-tag {
  background: #e0f2fe;
  color: #0284c7;
}
.talk-schedule-compact-card.outbound .talk-number-tag {
  background: #ede9fe;
  color: #7c3aed;
}
.talk-meta-line {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.talk-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.talk-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
body.high-contrast .talk-schedule-compact-card {
  background: var(--bg-card);
  border-color: #334155;
}
body.high-contrast .talk-schedule-compact-card.inbound .talk-date-badge {
  background: #082f49;
  border-color: #0369a1;
}
body.high-contrast .talk-schedule-compact-card.outbound .talk-date-badge {
  background: #2e1065;
  border-color: #6d28d9;
}
body.high-contrast .talk-title-text {
  color: var(--text-main);
}

/* ==========================================================================
   CENTRAL DE NOTIFICAÇÕES & PWA INSTALÁVEL (RF-16 & OPÇÃO A)
   ========================================================================== */

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botão de Instalação do PWA */
.btn-install-pwa {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-install-pwa:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .btn-install-pwa .install-label {
    display: none;
  }
  .btn-install-pwa {
    padding: 5px 8px;
    border-radius: 50%;
  }
}

/* Botão de Notificações / Sino */
.notif-bell-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  flex-shrink: 0;
}

.notif-bell-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.notif-bell-btn:active {
  transform: scale(0.95);
}

/* Badge numérico de notificações não lidas */
.notif-unread-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #1e3a8a;
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Itens da lista de Notificações */
.notif-card-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.notif-card-item:hover {
  background: #f8fafc;
}

.notif-card-item.unread {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
}

.notif-card-item.emergency {
  background: #fef2f2;
  border-left: 4px solid #dc2626;
}

.notif-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: #f1f5f9;
}

.notif-card-item.unread .notif-icon-circle {
  background: #dbeafe;
}

.notif-card-item.emergency .notif-icon-circle {
  background: #fee2e2;
}

.notif-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

.notif-title-text {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-main);
}

.notif-card-item.unread .notif-title-text {
  color: #1e3a8a;
}

.notif-card-item.emergency .notif-title-text {
  color: #991b1b;
}

.notif-time-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.notif-message-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 3px;
}

.notif-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #2563eb;
  margin-top: 6px;
  text-decoration: none;
}

.notif-action-btn:hover {
  text-decoration: underline;
}

/* Guia de Instalação iOS / PWA */
.pwa-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.pwa-step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2563eb;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}








