/* ==========================================================================
   CONFIGURAÇÕES GLOBAIS E TOKENS DE DESIGN (MATERIAL DESIGN 3)
   ========================================================================== */

:root {
  /* Cores - Tema Claro Vibrante (Default) */
  --md-sys-color-primary: #6366f1; /* Indigo vibrante */
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #e0e7ff;
  --md-sys-color-on-primary-container: #312e81;
  
  --md-sys-color-secondary: #0ea5e9; /* Sky Blue vibrante */
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #e0f2fe;
  --md-sys-color-on-secondary-container: #0369a1;
  
  --md-sys-color-tertiary: #d946ef; /* Magenta vibrante */
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #fdf4ff;
  --md-sys-color-on-tertiary-container: #701a75;
  
  --md-sys-color-background: #f8fafc; /* Slate claro */
  --md-sys-color-on-background: #0f172a;
  
  --md-sys-color-surface: #ffffff;
  --md-sys-color-on-surface: #0f172a;
  --md-sys-color-surface-variant: #f1f5f9;
  --md-sys-color-on-surface-variant: #475569;
  
  --md-sys-color-outline: #64748b;
  --md-sys-color-outline-variant: #cbd5e1;
  
  --md-sys-color-error: #ef4444; /* Vermelho vivo */
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #fee2e2;
  --md-sys-color-on-error-container: #991b1b;
  
  --md-sys-color-success: #10b981; /* Verde esmeralda */
  --md-sys-color-on-success: #ffffff;
  --md-sys-color-success-container: #d1fae5;
  --md-sys-color-on-success-container: #065f46;

  /* Níveis de Elevação / Sombras */
  --elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.05), 0px 1px 2px 0px rgba(0, 0, 0, 0.08);
  --elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.06), 0px 1px 2px 0px rgba(0, 0, 0, 0.1);
  --elevation-3: 0px 4px 12px 4px rgba(0, 0, 0, 0.08), 0px 2px 4px 0px rgba(0, 0, 0, 0.12);
  
  /* Fontes e Tipografia */
  --font-brand: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-plain: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  
  /* Animações */
  --easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --transition-fast: 0.15s var(--easing-standard);
  --transition-normal: 0.25s var(--easing-standard);
}

/* Cores - Tema Escuro Vibrante */
@media (prefers-color-scheme: dark) {
  :root {
    --md-sys-color-primary: #c7d2fe;
    --md-sys-color-on-primary: #1e1b4b;
    --md-sys-color-primary-container: #3730a3;
    --md-sys-color-on-primary-container: #e0e7ff;
    
    --md-sys-color-secondary: #7dd3fc;
    --md-sys-color-on-secondary: #0369a1;
    --md-sys-color-secondary-container: #0c4a6e;
    --md-sys-color-on-secondary-container: #e0f2fe;
    
    --md-sys-color-tertiary: #f5d0fe;
    --md-sys-color-on-tertiary: #701a75;
    --md-sys-color-tertiary-container: #86198f;
    --md-sys-color-on-tertiary-container: #fdf4ff;
    
    --md-sys-color-background: #0f172a;
    --md-sys-color-on-background: #f8fafc;
    
    --md-sys-color-surface: #1e293b;
    --md-sys-color-on-surface: #f8fafc;
    --md-sys-color-surface-variant: #334155;
    --md-sys-color-on-surface-variant: #cbd5e1;
    
    --md-sys-color-outline: #94a3b8;
    --md-sys-color-outline-variant: #475569;
    
    --md-sys-color-error: #fca5a5;
    --md-sys-color-on-error: #7f1d1d;
    --md-sys-color-error-container: #991b1b;
    --md-sys-color-on-error-container: #fee2e2;
    
    --md-sys-color-success: #6ee7b7;
    --md-sys-color-on-success: #065f46;
    --md-sys-color-success-container: #064e3b;
    --md-sys-color-on-success-container: #d1fae5;

    --elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.2), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
    --elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.24), 0px 1px 2px 0px rgba(0, 0, 0, 0.38);
    --elevation-3: 0px 4px 12px 4px rgba(0, 0, 0, 0.3), 0px 2px 4px 0px rgba(0, 0, 0, 0.45);
  }
}
[data-theme="dark"] {
  --md-sys-color-primary: #c7d2fe;
  --md-sys-color-on-primary: #1e1b4b;
  --md-sys-color-primary-container: #3730a3;
  --md-sys-color-on-primary-container: #e0e7ff;
  
  --md-sys-color-secondary: #7dd3fc;
  --md-sys-color-on-secondary: #0369a1;
  --md-sys-color-secondary-container: #0c4a6e;
  --md-sys-color-on-secondary-container: #e0f2fe;
  
  --md-sys-color-tertiary: #f5d0fe;
  --md-sys-color-on-tertiary: #701a75;
  --md-sys-color-tertiary-container: #86198f;
  --md-sys-color-on-tertiary-container: #fdf4ff;
  
  --md-sys-color-background: #0f172a;
  --md-sys-color-on-background: #f8fafc;
  
  --md-sys-color-surface: #1e293b;
  --md-sys-color-on-surface: #f8fafc;
  --md-sys-color-surface-variant: #334155;
  --md-sys-color-on-surface-variant: #cbd5e1;
  
  --md-sys-color-outline: #94a3b8;
  --md-sys-color-outline-variant: #475569;
  
  --md-sys-color-error: #fca5a5;
  --md-sys-color-on-error: #7f1d1d;
  --md-sys-color-error-container: #991b1b;
  --md-sys-color-on-error-container: #fee2e2;
  
  --md-sys-color-success: #6ee7b7;
  --md-sys-color-on-success: #065f46;
  --md-sys-color-success-container: #064e3b;
  --md-sys-color-on-success-container: #d1fae5;

  --elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.2), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
  --elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.24), 0px 1px 2px 0px rgba(0, 0, 0, 0.38);
  --elevation-3: 0px 4px 12px 4px rgba(0, 0, 0, 0.3), 0px 2px 4px 0px rgba(0, 0, 0, 0.45);
}
[data-theme="light"] {
  --md-sys-color-primary: #6366f1;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #e0e7ff;
  --md-sys-color-on-primary-container: #312e81;
  --md-sys-color-secondary: #0ea5e9;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #e0f2fe;
  --md-sys-color-on-secondary-container: #0369a1;
  --md-sys-color-tertiary: #d946ef;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #fdf4ff;
  --md-sys-color-on-tertiary-container: #701a75;
  --md-sys-color-background: #f8fafc;
  --md-sys-color-on-background: #0f172a;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-on-surface: #0f172a;
  --md-sys-color-surface-variant: #f1f5f9;
  --md-sys-color-on-surface-variant: #475569;
  --md-sys-color-outline: #64748b;
  --md-sys-color-outline-variant: #cbd5e1;
  --md-sys-color-error: #ef4444;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #fee2e2;
  --md-sys-color-on-error-container: #991b1b;
  --md-sys-color-success: #10b981;
  --md-sys-color-on-success: #ffffff;
  --md-sys-color-success-container: #d1fae5;
  --md-sys-color-on-success-container: #065f46;
  --elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.05), 0px 1px 2px 0px rgba(0, 0, 0, 0.08);
  --elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.06), 0px 1px 2px 0px rgba(0, 0, 0, 0.1);
  --elevation-3: 0px 4px 12px 4px rgba(0, 0, 0, 0.08), 0px 2px 4px 0px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   RESET E CONFIGURAÇÕES BÁSICAS
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-plain);
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  line-height: 1.5;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* ==========================================================================
   CONTAINER E LAYOUT CENTRALIZADO (MÓVEL E DESKTOP)
   ========================================================================== */

.app-container {
  width: 100%;
  max-width: 900px;
  min-height: 100vh;
  padding: 24px 16px 100px 16px;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   CABEÇALHO DA APLICAÇÃO (HEADER BAR)
   ========================================================================== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--md-sys-color-surface-variant);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 36px;
  color: var(--md-sys-color-primary);
  background: var(--md-sys-color-primary-container);
  padding: 12px;
  border-radius: 16px;
}

.brand-text h1 {
  font-family: var(--font-brand);
  font-size: 28px;
  font-weight: 700;
  color: var(--md-sys-color-on-background);
  line-height: 1.1;
}

.brand-text p {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Badge do Simulador */
.mode-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 16px;
  background-color: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.mode-badge:hover {
  background-color: var(--md-sys-color-secondary-container);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--md-sys-color-outline);
}

.mode-badge.badge-simulador .badge-dot {
  background-color: var(--md-sys-color-primary);
  box-shadow: 0 0 6px var(--md-sys-color-primary);
}

.mode-badge.badge-real .badge-dot {
  background-color: var(--md-sys-color-success);
  box-shadow: 0 0 6px var(--md-sys-color-success);
}

/* ==========================================================================
   CONTEÚDO PRINCIPAL (DASHBOARD)
   ========================================================================== */

.main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Métricas M3 (Cards de Resumo) */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.metrics-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 16px;
  background-color: var(--md-sys-color-surface);
  box-shadow: var(--elevation-1);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: transform var(--transition-fast);
}

.metrics-card:hover {
  transform: translateY(-2px);
}

.metrics-card .card-icon {
  font-size: 28px;
  color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-primary-container);
  padding: 10px;
  border-radius: 12px;
}

.metrics-card .card-icon.icon-success {
  color: var(--md-sys-color-success);
  background-color: var(--md-sys-color-success-container);
}

.card-info {
  display: flex;
  flex-direction: column;
}

.card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}

.card-info h3 {
  font-family: var(--font-brand);
  font-size: 24px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  line-height: 1.1;
}

/* Seção de Processos */
.process-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media(min-width: 600px) {
  .section-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.section-header h2 {
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 600;
  color: var(--md-sys-color-on-background);
}

/* Caixa de Busca */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 48px;
  border-radius: 24px;
  background-color: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  width: 100%;
  max-width: 350px;
  transition: var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 1px var(--md-sys-color-primary);
  background-color: var(--md-sys-color-background);
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  width: 100%;
}

.search-icon {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 20px;
}

/* Grid de cards de processos */
.process-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Card de Processo (M3 Elevated Card) */
.process-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border-radius: 16px;
  background-color: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--elevation-1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.process-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-2);
  border-color: var(--md-sys-color-primary);
}

/* Badge de Notificação/Novidade no card */
.card-notification-dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--md-sys-color-error);
  box-shadow: 0 0 6px var(--md-sys-color-error);
}

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

.process-card-number {
  font-family: var(--font-brand);
  font-size: 16px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.3;
}

.process-card.has-new-movement {
  border-left: 4px solid #ef4444 !important;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, var(--md-sys-color-surface) 100%) !important;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.12) !important;
}

.btn-sync-manual {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-sync-manual.is-syncing .sync-animated-spin {
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.sync-status-timestamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 4px;
}

/* Chips Tonalizados M3 */
.court-chip {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.court-chip.tj { background-color: #d7e3f7; color: #101c2b; }
.court-chip.trf { background-color: #ffdcb2; color: #2f1500; }
.court-chip.trt { background-color: #ffd9e2; color: #3e001d; }
.court-chip.sup { background-color: #e8def8; color: #1d192b; }

.process-card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 12px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-row .material-symbols-rounded {
  font-size: 16px;
}

.process-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: 11px;
  color: var(--md-sys-color-outline);
}

/* ==========================================================================
   ESTADOS VAZIOS (EMPTY STATES)
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  background-color: var(--md-sys-color-surface);
  border: 1px dashed var(--md-sys-color-outline);
  border-radius: 24px;
}

.empty-icon {
  font-size: 64px;
  color: var(--md-sys-color-outline);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: var(--font-brand);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  max-width: 320px;
  margin-bottom: 20px;
}

/* ==========================================================================
   FLOATING ACTION BUTTON (M3 FAB)
   ========================================================================== */

.md-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 56px;
  border-radius: 16px;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border: none;
  cursor: pointer;
  box-shadow: var(--elevation-3);
  font-size: 14px;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
  z-index: 10;
}

.md-fab:hover {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  transform: scale(1.05);
}

.md-fab .material-symbols-rounded {
  font-size: 24px;
}

@media(max-width: 600px) {
  .md-fab {
    padding: 0;
    width: 56px;
    justify-content: center;
  }
  .md-fab span:not(.material-symbols-rounded) {
    display: none;
  }
}

/* ==========================================================================
   BOTOÕES MATERIAL 3 (BUTTONS)
   ========================================================================== */

.md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.md-btn-primary {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.md-btn-primary:hover {
  box-shadow: var(--elevation-1);
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 88%, #000);
}

.md-btn-tonal {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.md-btn-tonal:hover {
  background-color: var(--md-sys-color-outline-variant);
}

.md-btn-text {
  background: transparent;
  color: var(--md-sys-color-primary);
  padding: 0 16px;
}

.md-btn-text:hover {
  background-color: rgba(0, 95, 175, 0.08);
}

.md-btn-outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.md-btn-outlined:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
}

.md-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.md-btn-error {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.md-btn-error:hover {
  background-color: #ffb4ab;
}

.md-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  transition: var(--transition-fast);
}

.md-btn-icon:hover {
  background-color: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface);
}

.text-danger {
  color: var(--md-sys-color-error) !important;
}

/* ==========================================================================
   MODAIS E CAIXAS DE DIÁLOGO (M3 DIALOGS)
   ========================================================================== */

.md-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(17, 19, 24, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 100;
}

.md-dialog-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.md-dialog {
  background-color: var(--md-sys-color-surface);
  border-radius: 28px;
  box-shadow: var(--elevation-3);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform var(--transition-normal);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.md-dialog-overlay.active .md-dialog {
  transform: translateY(0);
}

.dialog-large {
  max-width: 700px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px 24px;
}

.dialog-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialog-header-icon {
  font-size: 24px;
  color: var(--md-sys-color-primary);
}

.dialog-title-group h3 {
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.close-dialog-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.close-dialog-btn:hover {
  background-color: var(--md-sys-color-surface-variant);
}

.dialog-content {
  padding: 0 24px 24px 24px;
  overflow-y: auto;
  flex-grow: 1;
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
}

.dialog-description {
  margin-bottom: 16px;
  font-size: 13px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 24px 24px;
  border-top: 1px solid var(--md-sys-color-surface-variant);
}

/* ==========================================================================
   INPUTS E COMPONENTES DE FORMULÁRIO (M3 INPUTS)
   ========================================================================== */

/* Text Field (Material Outlined) */
.md-text-field {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 12px;
  height: 52px;
  padding: 0 16px;
  background-color: var(--md-sys-color-surface);
  transition: var(--transition-fast);
  margin-bottom: 16px;
}

.md-text-field:focus-within {
  border-color: var(--md-sys-color-primary);
  border-width: 2px;
  background-color: var(--md-sys-color-background);
}

.md-text-field input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  width: 100%;
}

.md-text-field .field-icon {
  color: var(--md-sys-color-on-surface-variant);
}

.clear-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toggle Switch M3 */
.form-row-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-title {
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  font-size: 14px;
}

.toggle-desc {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
}

.md-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 32px;
}

.md-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--md-sys-color-surface-variant);
  border: 2px solid var(--md-sys-color-outline);
  transition: .3s;
  border-radius: 16px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 6px;
  bottom: 6px;
  background-color: var(--md-sys-color-outline);
  transition: .3s;
  border-radius: 50%;
}

.md-switch input:checked + .switch-slider {
  background-color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

.md-switch input:checked + .switch-slider:before {
  transform: translateX(20px);
  background-color: var(--md-sys-color-on-primary);
  width: 20px;
  height: 20px;
  bottom: 4px;
  left: 4px;
}

/* Formulário de Cadastro Manual */
.manual-form-container {
  margin-top: 16px;
  animation: slideDown var(--transition-normal);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-divider {
  height: 1px;
  background-color: var(--md-sys-color-surface-variant);
  margin: 16px 0;
}

.manual-form-container h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-primary);
  margin-bottom: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.form-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.form-field-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}

.form-field-group input, .form-field-group select {
  width: 100%;
  min-width: 0;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline-variant);
  padding: 0 12px;
  font-size: 13px;
  background-color: var(--md-sys-color-surface);
  outline: none;
}

.form-field-group input:focus, .form-field-group select:focus {
  border-color: var(--md-sys-color-primary);
  border-width: 2px;
}

/* ==========================================================================
   TABS INTERNAS DO DIALOG DE DETALHES
   ========================================================================== */

.dialog-tabs {
  display: flex;
  border-bottom: 1px solid var(--md-sys-color-surface-variant);
  margin-bottom: 20px;
  gap: 4px;
}

.tab-btn {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  border-bottom: 3px solid transparent;
  transition: var(--transition-fast);
  padding: 0 12px;
  border-radius: 8px 8px 0 0;
}

.tab-btn:hover {
  background-color: rgba(83, 95, 112, 0.08);
}

.tab-btn.active {
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
}

.tab-badge {
  font-size: 10px;
  background-color: var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  padding: 2px 6px;
  border-radius: 10px;
}

.modal-tab-content {
  display: none;
}

.modal-tab-content.active-tab {
  display: block;
}

/* ==========================================================================
   TIMELINE (HISTÓRICO)
   ========================================================================== */

.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 20px;
  margin-left: 10px;
  border-left: 2px solid var(--md-sys-color-surface-variant);
  max-height: 400px;
  overflow-y: auto;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -27px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--md-sys-color-outline-variant);
  border: 2px solid var(--md-sys-color-surface);
}

.timeline-item:first-child .timeline-dot {
  background-color: var(--md-sys-color-primary);
  box-shadow: 0 0 6px var(--md-sys-color-primary);
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-date {
  font-size: 11px;
  color: var(--md-sys-color-outline);
  font-weight: 500;
}

.timeline-desc {
  font-weight: 600;
  font-size: 13px;
  color: var(--md-sys-color-on-surface);
}

.timeline-details {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 4px;
  background-color: var(--md-sys-color-surface);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline-variant);
}

/* Outros Detalhes de Processos */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background-color: var(--md-sys-color-surface);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
  margin-bottom: 20px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-label {
  font-size: 11px;
  color: var(--md-sys-color-outline);
  font-weight: 500;
}

.info-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.parties-container {
  margin-bottom: 20px;
}

.parties-container h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.parties-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media(min-width: 500px) {
  .parties-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.party-block {
  background-color: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 12px 16px;
}

.party-role {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.party-role.role-active {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.party-role.role-passive {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.party-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.party-item-name {
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.party-item-doc {
  font-size: 10px;
  color: var(--md-sys-color-outline);
}

.last-movement-highlight {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  padding: 16px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.highlight-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.highlight-header .material-symbols-rounded {
  font-size: 16px;
}

#modal-last-movement-desc {
  font-size: 13px;
  font-weight: 500;
}

.highlight-date {
  font-size: 10px;
  opacity: 0.8;
}

/* Configurações */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-group h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.settings-desc {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.4;
}

.settings-info-text {
  font-size: 11px;
  color: var(--md-sys-color-outline);
}

.settings-info-text a {
  color: var(--md-sys-color-primary);
  text-decoration: none;
  font-weight: 600;
}

.settings-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

/* ==========================================================================
   TOASTS / NOTIFICAÇÕES (SNACKBAR M3)
   ========================================================================== */

.snackbar-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  width: 90%;
  max-width: 400px;
}

.snackbar {
  background-color: #313033;
  color: #f4eff4;
  border-radius: 4px;
  padding: 14px 16px;
  font-size: 13px;
  box-shadow: var(--elevation-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  animation: slideUpSnackbar 0.3s var(--easing-standard);
}

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

.snackbar-text {
  flex-grow: 1;
}

.snackbar-action {
  border: none;
  background: transparent;
  color: #d0bcff;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.snackbar-action:hover {
  background-color: rgba(208, 188, 255, 0.08);
}

/* ==========================================================================
   GERENCIAMENTO DE PDF E TARJA DE DESATUALIZAÇÃO
   ========================================================================== */

.pdf-management-container {
  background-color: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 16px;
  margin-top: 20px;
  padding: 16px;
}

.pdf-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pdf-header h4 {
  font-family: var(--font-brand);
  font-size: 14px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.pdf-status-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px;
  gap: 8px;
}

.pdf-status-empty p {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  max-width: 320px;
}

.pdf-status-active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pdf-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-radius: 12px;
}

.file-pdf-icon {
  font-size: 28px;
  color: #ba1a1a;
}

.pdf-file-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.pdf-filename {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-filesize {
  font-size: 11px;
  opacity: 0.8;
}

.pdf-outdated-banner {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  border-left: 4px solid var(--md-sys-color-error);
  padding: 12px 16px;
  border-radius: 4px 12px 12px 4px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  animation: pulseWarning 2s infinite;
}

.pdf-outdated-banner .material-symbols-rounded {
  color: var(--md-sys-color-error);
}

@keyframes pulseWarning {
  0% { box-shadow: 0 0 0 0 rgba(186, 26, 26, 0.2); }
  70% { box-shadow: 0 0 0 6px rgba(186, 26, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(186, 26, 26, 0); }
}

/* Badge no card de processo do dashboard */
.badge-outdated {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-outdated .material-symbols-rounded {
  font-size: 12px;
}

/* ==========================================================================
   FICHA TÉCNICA DO EXPERT
   ========================================================================== */

.expert-info-card {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: 16px;
  padding: 16px;
  margin-top: 20px;
  border: 1px solid var(--md-sys-color-primary);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0px 4px 10px rgba(0, 95, 175, 0.08);
}

.expert-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-brand);
  font-size: 14px;
  font-weight: 600;
}

.expert-card-header .md-btn-icon {
  margin-left: auto;
  color: var(--md-sys-color-primary);
}

.expert-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media(min-width: 500px) {
  .expert-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.expert-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.expert-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
  font-weight: 700;
}

.expert-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-primary-container);
}

.expert-object-row {
  border-top: 1px dashed rgba(0, 95, 175, 0.2);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Formulário de Edição da Ficha */
.expert-info-edit {
  background-color: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface-variant);
  border-radius: 16px;
  padding: 16px;
  margin-top: 20px;
  border: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-header h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
}

.edit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media(min-width: 500px) {
  .edit-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.edit-actions {
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding-top: 12px;
}

/* ==========================================================================
   LAYOUT DA AGENDA E TAREFAS (CALENDÁRIO E TO-DO)
   ========================================================================== */
.agenda-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 10px;
}

@media(min-width: 768px) {
  .agenda-layout-grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

/* Bloco do Calendário */
.agenda-calendar-block {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
}

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

.calendar-header-widget h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--md-sys-color-primary);
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  font-size: 11px;
}

.calendar-day-header {
  font-weight: 600;
  color: var(--md-sys-color-outline);
  padding: 6px 0;
}

.calendar-day-cell {
  height: 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 8px;
  position: relative;
  transition: var(--transition-fast);
  color: var(--md-sys-color-on-surface);
}

.calendar-day-cell:hover:not(.empty) {
  background-color: var(--md-sys-color-surface-variant);
}

.calendar-day-cell.today {
  border: 2px solid var(--md-sys-color-primary);
  font-weight: bold;
}

.calendar-day-cell.selected {
  background-color: var(--md-sys-color-primary) !important;
  color: var(--md-sys-color-on-primary) !important;
}

.calendar-day-cell.has-deadline::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--md-sys-color-error);
}

.calendar-day-cell.selected.has-deadline::after {
  background-color: var(--md-sys-color-on-primary);
}

.calendar-selected-details {
  margin-top: 16px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding-top: 12px;
  min-height: 60px;
}

.selected-day-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 6px;
}

.selected-day-deadlines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-deadline-item {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  border-left: 4px solid var(--md-sys-color-error);
}

.day-deadline-item h5 {
  font-weight: 600;
  margin: 0 0 2px 0;
}

.day-deadline-item p {
  margin: 0;
  opacity: 0.9;
  font-size: 11px;
}

/* Bloco de Tarefas */
.agenda-tasks-block {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tasks-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tasks-header-bar h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.tasks-subtitle {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.tasks-list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

/* M3 Checkbox Item */
.task-item-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background-color: var(--md-sys-color-surface);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline-variant);
  cursor: pointer;
  transition: var(--transition-fast);
}

.task-item-checkbox:hover {
  background-color: var(--md-sys-color-surface-variant);
}

.task-item-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--md-sys-color-primary);
  cursor: pointer;
  margin-top: 2px;
}

.task-checkbox-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
}

.task-checkbox-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.task-item-checkbox input[type="checkbox"]:checked ~ .task-checkbox-details .task-checkbox-title {
  text-decoration: line-through;
  opacity: 0.6;
}

.task-item-checkbox input[type="checkbox"]:checked ~ .task-checkbox-details {
  opacity: 0.6;
}

.task-checkbox-desc {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
}

.task-checkbox-badge-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.task-date-badge {
  font-size: 10px;
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.task-cpc-badge {
  font-size: 10px;
  background-color: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.md-btn-compact {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.task-delete-btn {
  margin-left: auto;
  color: var(--md-sys-color-error);
  align-self: center;
}

/* Abas de Configurações */
.settings-tab-content {
  display: none;
  animation: fadeIn var(--transition-normal);
}

.settings-tab-content.active-tab {
  display: block;
}

#settings-dialog-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
#settings-dialog-tabs .tab-btn {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  height: auto;
  padding: 10px 14px;
  border-bottom: none;
  border-radius: 20px;
  justify-content: center;
  font-size: 13px;
}
#settings-dialog-tabs .tab-btn.active {
  border-bottom: none;
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* ==========================================================================
   TELA DE AUTENTICAÇÃO (LOGIN / REGISTRO) - M3 PREMIUM GLASS
   ========================================================================== */
.auth-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* iPhone: 100vh inclui as barras do Safari e cortava o fim */
  background: radial-gradient(circle at 10% 20%, var(--md-sys-color-surface-container-low) 0%, var(--md-sys-color-background) 90.1%);
  display: flex;
  /* v1.1.162: a tela é fixa; sem rolagem, o cadastro (mais alto que a tela do
     celular) ficava centralizado e cortado — o botão "Criar Conta" sumia.
     Agora rola, e o cartão só centraliza quando cabe (margin auto abaixo). */
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 9999;
  padding: 16px;
  animation: fadeIn var(--transition-normal);
}

.auth-screen > .auth-card {
  margin-top: auto;
  margin-bottom: auto;
  flex-shrink: 0;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 28px;
  padding: 32px 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

/* Modo escuro para o glassmorphism da autenticação */
@media (prefers-color-scheme: dark) {
  .auth-card {
    background: rgba(30, 30, 30, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  }
}
[data-theme="dark"] .auth-card {
  background: rgba(30, 30, 30, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.auth-header .logo-icon {
  font-size: 48px;
  color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  padding: 16px;
  border-radius: 20px;
  margin-bottom: 8px;
  display: inline-flex;
}

.auth-header h1,
.auth-header h2 {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  letter-spacing: -0.5px;
}

.auth-header p {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.4;
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-message-box {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  border: 1px solid var(--md-sys-color-error);
  animation: shake 0.4s ease;
}

.auth-message-box.success {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: var(--md-sys-color-secondary);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Abas Principais do Dashboard (Material Design 3) */
.dashboard-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  margin-bottom: 24px;
  padding-bottom: 4px;
}

.dashboard-tabs .dash-tab-btn {
  background: none;
  border: none;
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  border-radius: 12px 12px 0 0;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-tabs .dash-tab-btn:hover {
  color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface-container-low);
}

.dashboard-tabs .dash-tab-btn.active {
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface-container-low);
}

/* Painel Financeiro - Tabela e Detalhes */
.finance-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.finance-table th {
  padding: 16px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  background-color: var(--md-sys-color-surface-container-high);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.finance-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  vertical-align: middle;
}

.finance-table tr:hover {
  background-color: var(--md-sys-color-surface-container-highest);
}

.badge-deposit {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-deposit.yes {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.badge-deposit.no {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

/* Painel financeiro 1.1.22 — visual baseado na demonstração pública */
/* Cores do painel em variáveis (v1.1.152): no tema escuro os cartões eram brancos
   fixos com o conteúdo interno claro (variáveis do tema) e o título escuro sobre
   o fundo escuro, ilegíveis. Valores do tema claro iguais aos de antes. */
:root { --fin-cartao:#fff; --fin-borda:#e2e8f0; --fin-eixo:#cbd5e1; --fin-titulo:#172033; --fin-texto:#334155; --fin-texto-suave:#64748b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --fin-cartao:var(--md-sys-color-surface); --fin-borda:var(--md-sys-color-outline-variant); --fin-eixo:var(--md-sys-color-outline); --fin-titulo:var(--md-sys-color-on-surface); --fin-texto:var(--md-sys-color-on-surface-variant); --fin-texto-suave:var(--md-sys-color-on-surface-variant); }
}
[data-theme="dark"] { --fin-cartao:var(--md-sys-color-surface); --fin-borda:var(--md-sys-color-outline-variant); --fin-eixo:var(--md-sys-color-outline); --fin-titulo:var(--md-sys-color-on-surface); --fin-texto:var(--md-sys-color-on-surface-variant); --fin-texto-suave:var(--md-sys-color-on-surface-variant); }
.finance-page-header { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; margin-bottom:24px; }
.finance-page-header h2 { margin:3px 0 4px; font-size:30px; color:var(--fin-titulo); }
.finance-page-header p { margin:0; color:var(--fin-texto-suave); }
.finance-eyebrow { color:#4f46e5; font-size:11px; font-weight:800; letter-spacing:.1em; }
.finance-updated { display:inline-flex; align-items:center; gap:7px; color:var(--fin-texto-suave); font-size:12px; white-space:nowrap; }
.finance-updated .material-symbols-rounded { font-size:18px; }
.finance-overview-grid { display:grid; grid-template-columns:1.55fr repeat(5,1fr); gap:14px; margin-bottom:18px; }
.finance-highlight-card, .finance-stat-card, .finance-panel { border:1px solid var(--fin-borda); background:var(--fin-cartao); box-shadow:0 5px 18px rgba(15,23,42,.06); }
.finance-highlight-card { min-height:184px; padding:28px; border:0; border-radius:16px; color:#fff; background:linear-gradient(135deg,#173f9f,#082a70); box-shadow:0 14px 28px rgba(15,54,139,.2); }
.finance-highlight-card div { display:flex; align-items:center; justify-content:space-between; font-size:16px; font-weight:700; }
.finance-highlight-card div .material-symbols-rounded { padding:11px; border:1px solid rgba(255,255,255,.16); border-radius:50%; }
.finance-highlight-card strong { display:block; margin:25px 0 8px; font-size:clamp(27px,2.4vw,39px); letter-spacing:-.04em; white-space:nowrap; }
.finance-highlight-card small { color:#bfdbfe; }
.finance-stat-card { min-height:184px; padding:20px 13px; border-radius:14px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:7px; color:var(--fin-texto); }
.finance-stat-card strong { color:var(--fin-titulo); font-size:18px; }
.finance-stat-card small { color:var(--md-sys-color-on-surface-variant); font-size:12px; }
.finance-stat-icon { padding:12px; border-radius:50%; color:#fff; margin-bottom:5px; }
.finance-stat-icon.blue { background:#2855c7; }.finance-stat-icon.green { background:#3fb45b; }.finance-stat-icon.amber { background:#f5a915; }
.finance-insights-grid { display:grid; grid-template-columns:minmax(0,2fr) minmax(260px,.9fr); gap:16px; margin-bottom:18px; }
.finance-panel { border-radius:15px; padding:22px; }
.finance-panel h3 { margin:0 0 18px; color:var(--fin-titulo); font-size:16px; }
.finance-chart { height:210px; display:flex; align-items:flex-end; gap:clamp(7px,1.3vw,18px); padding:18px 10px 0; border-bottom:1px solid var(--fin-eixo); background:repeating-linear-gradient(to bottom,transparent 0,transparent 51px,var(--fin-borda) 52px); }
.finance-chart-column { height:100%; flex:1; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:7px; min-width:16px; }
.finance-chart-bar { width:min(28px,75%); min-height:3px; border-radius:5px 5px 1px 1px; background:linear-gradient(180deg,#779cf7,#4f7eea); box-shadow:0 3px 8px rgba(79,126,234,.22); }
.finance-chart-label { color:var(--fin-texto-suave); font-size:10px; }
.finance-summary > div { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:14px 0; border-bottom:1px solid var(--fin-borda); color:var(--fin-texto); font-size:12px; }
.finance-summary > div:last-child { border-bottom:0; }.finance-summary strong { color:var(--md-sys-color-primary); }.finance-summary strong.positive { color:var(--md-sys-color-success); }.finance-summary strong.pending { color:var(--md-sys-color-warning, #9a6212); }
.finance-process-panel { padding:0; overflow:hidden; }.finance-process-panel .section-header { padding:20px 22px 0; }.finance-process-panel .section-header h2 { font-size:17px; }
.finance-table-container { overflow-x:auto; margin-top:12px; }.finance-table { min-width:760px; font-size:12px; }

@media (max-width: 1250px) {
  .finance-overview-grid { grid-template-columns:repeat(3,1fr); }
  .finance-highlight-card { grid-column:1 / -1; min-height:150px; }
  .finance-highlight-card strong { margin:16px 0 6px; }
}
@media (max-width: 850px) {
  .finance-overview-grid { grid-template-columns:repeat(2,1fr); }
  .finance-insights-grid { grid-template-columns:1fr; }
}
@media (max-width: 560px) {
  .finance-page-header { flex-direction:column; }.finance-page-header h2 { font-size:25px; }
  .finance-header-actions, .finance-comarca-filter { width:100%; box-sizing:border-box; }
  .finance-comarca-filter select { flex:1; min-width:0; max-width:none !important; }
  .finance-overview-grid { grid-template-columns:1fr; }
  .finance-highlight-card, .finance-stat-card { min-height:145px; }
  .finance-chart { gap:5px; padding-left:0; padding-right:0; }
}

.badge-deposit.partial {
  background-color: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
}

/* ==========================================================================
   TAB - ANÁLISE IA
   ========================================================================== */
#ai-analysis-container {
  padding: 8px 0;
}

.ai-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 16px;
}

.ai-empty-state h4 {
  font-size: 18px;
  margin-bottom: 8px;
}

.ai-empty-state p {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  max-width: 400px;
  margin-bottom: 24px;
}

.btn-ai-generate {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: white;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-ai-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-ai-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50px 24px;
  text-align: center;
}

.ai-loading-spinner {
  font-size: 48px;
  color: #7c3aed;
  animation: ai-spin 2s linear infinite;
}

@keyframes ai-spin {
  100% { transform: rotate(360deg); }
}

.ai-loading p {
  font-size: 14px;
  margin-top: 16px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.ai-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(124, 58, 237, 0.08);
  border: 1px dashed rgba(124, 58, 237, 0.3);
  border-radius: 12px;
  padding: 14px;
}

.ai-result-header h4 {
  margin: 0;
  font-size: 16px;
  color: #7c3aed;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-section {
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 16px;
}

.ai-section h5 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
}

.ai-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ai-section li {
  background: var(--md-sys-color-surface-variant);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  border-left: 3px solid #7c3aed;
  font-size: 13px;
}

.ai-section li:last-child {
  margin-bottom: 0;
}

.ai-section li strong {
  display: block;
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 4px;
}

.ai-section li .deadline-info {
  margin-top: 4px;
  font-size: 11px;
  color: var(--md-sys-color-outline);
}

.btn-ai-apply {
  background: #7c3aed;
  color: white;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 12px;
}

.btn-ai-apply:hover {
  background: #6d28d9;
}

.btn-ai-apply:disabled {
  background: #ccc;
  cursor: not-allowed;
  color: #777;
}

.ai-tech-message {
  text-align: center;
  font-size: 12px;
  color: var(--md-sys-color-outline);
  margin: 20px auto 0;
  padding: 8px 12px;
  background: var(--md-sys-color-surface-variant);
  border-radius: 8px;
}

@media (prefers-color-scheme: dark) {
  .ai-result-header {
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.3);
  }
  .ai-result-header h4 {
    color: #c481ff;
  }
}
[data-theme="dark"] .ai-result-header {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.3);
}
[data-theme="dark"] .ai-result-header h4 {
  color: #c481ff;
}

/* ==========================================================================
   ANIMAÇÕES DE CARREGAMENTO E PROGRESSO AO VIVO (REGISTRO DATAJUD)
   ========================================================================== */

@keyframes spinSlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}

@keyframes shimmerProgress {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}

.spinning-icon {
  animation: spinSlow 1.1s linear infinite;
  display: inline-block;
}

.pulsing-badge {
  animation: pulseGlow 1.4s ease-in-out infinite;
}

.loading-progress-bar {
  height: 4px;
  width: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--md-sys-color-primary-container) 25%, var(--md-sys-color-primary) 50%, var(--md-sys-color-primary-container) 75%);
  background-size: 400px 100%;
  animation: shimmerProgress 1.4s infinite linear;
}

/* ==========================================================================
   RESPONSIVIDADE - Dispositivos Móveis
   ========================================================================== */

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .header-brand {
    justify-content: center;
  }
  .header-brand .brand-text h1 { font-size: 26px; }
  .header-brand .brand-text p { font-size: 12px; }
  .header-actions {
    justify-content: center;
    gap: 8px;
  }
  .user-greeting {
    max-width: 120px;
    font-size: 12px;
  }
  .app-content {
    padding: 12px;
  }
  .dashboard-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding: 4px;
  }
  .dashboard-tabs::-webkit-scrollbar { display: none; }
  .dashboard-tabs .tab-btn {
    flex: 0 0 auto;
    font-size: 12px;
    padding: 8px 14px;
    white-space: nowrap;
  }
  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .section-header h3 { font-size: 16px; }
  .section-header .filter-row {
    flex-wrap: wrap;
  }
  .md-card {
    padding: 14px;
  }
  .process-card {
    flex-direction: column;
    gap: 8px;
  }
  .process-card .proc-info { width: 100%; }
  .process-card .proc-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .metric-card { padding: 12px; }
  .metric-value { font-size: 20px; }
  .metric-label { font-size: 11px; }
  .finance-table-wrapper {
    margin: 0 -12px;
    border-radius: 0;
  }
  .search-box {
    max-width: 100%;
    width: 100%;
  }
  .md-fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    min-width: unset;
    bottom: 16px;
    right: 16px;
  }
  .md-fab span.fab-label { display: none; }
  .md-fab .material-symbols-rounded { margin: 0; }
  .alarm-item { flex-direction: column; gap: 8px; }
  .alarm-item .alarm-toggles { width: 100%; justify-content: flex-start; }
  .task-card { flex-direction: column; gap: 8px; }
  .task-card .task-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 480px) {
  .app-header { padding: 6px 8px; }
  .header-brand { width: 100%; justify-content: center; }
  .header-brand .brand-text h1 { font-size: 24px; }
  .header-brand .brand-text p { font-size: 11px; }
  .header-brand .brand-icon { font-size: 28px; padding: 10px; }
  .app-content { padding: 8px; }
  .md-dialog {
    margin: 8px;
    max-width: calc(100vw - 16px);
    border-radius: 16px;
  }
  .dialog-large { max-width: calc(100vw - 16px); }
  .settings-layout {
    flex-direction: column;
  }
  .settings-sidebar-tabs,
  #settings-dialog-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding-bottom: 6px;
    margin-bottom: 12px;
    gap: 4px;
  }
  .settings-sidebar-tabs .tab-btn,
  #settings-dialog-tabs .tab-btn {
    font-size: 12px;
    padding: 8px 10px;
  }
  .settings-tab-content { padding: 12px 0; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .metric-card { padding: 10px; }
  .metric-value { font-size: 18px; }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .parties-grid, .expert-grid, .edit-grid {
    grid-template-columns: 1fr;
  }
  .agenda-layout-grid {
    grid-template-columns: 1fr;
  }
  .calendar-header { font-size: 13px; }
  .calendar-day { min-height: 40px; font-size: 12px; }
  .auth-card {
    padding: 24px 16px;
    margin: 12px;
    max-width: calc(100vw - 24px);
  }
  .auth-form input { font-size: 14px; padding: 10px 12px; }
  .auth-toggle-text { font-size: 13px; }
  .section-header .filter-row .filter-btn {
    font-size: 11px;
    padding: 5px 10px;
  }
  .md-btn { padding: 8px 16px; font-size: 13px; }
  .toast-container { bottom: 12px; left: 12px; right: 12px; }
  .toast { font-size: 13px; padding: 10px 16px; }
}

/* Melhorias touch para dispositivos móveis */
@media (hover: none) and (pointer: coarse) {
  .md-btn, .tab-btn, .filter-btn, .action-icon-btn, .btn-apply-block {
    min-height: 44px;
  }
  select, input, textarea, button {
    font-size: 16px;
  }
  .md-btn-icon { min-width: 44px; min-height: 44px; }
}

/* ==========================================================================
   QUADRO KANBAN
   ========================================================================== */

.view-mode-selector {
  display: flex;
  gap: 4px;
  background: var(--md-sys-color-surface-variant);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
}

.view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-plain);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
}

.view-mode-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--md-sys-color-primary);
}

.view-mode-btn.active {
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-primary);
  box-shadow: var(--elevation-1);
}

.quadrant-badge {
  background: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
}

.kanban-board-wrapper {
  overflow-x: auto;
  padding-bottom: 12px;
  margin-top: 16px;
}

.kanban-board {
  display: flex;
  gap: 16px;
  min-width: 1320px;
}

.kanban-column {
  flex: 1;
  min-width: 210px;
  max-width: 260px;
  background: var(--md-sys-color-surface);
  border-radius: 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 420px;
  box-shadow: var(--elevation-1);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--md-sys-color-primary);
}

.kanban-column-title {
  font-family: var(--font-brand);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  max-height: 600px;
}

.board-process-card {
  background: var(--md-sys-color-surface-variant);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.board-process-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-2);
  border-color: var(--md-sys-color-primary);
}

.board-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.board-card-number {
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
}

.board-card-court {
  font-size: 10px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.12);
  color: var(--md-sys-color-primary);
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

.board-card-body {
  font-size: 12px;
  color: var(--md-sys-color-on-surface);
  line-height: 1.4;
}

.board-card-selectors {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.board-select {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-weight: 500;
  cursor: pointer;
}

/* Feedback Visual para Arrastar e Soltar (Drag & Drop) */
.board-process-card[draggable="true"] {
  cursor: grab;
  user-select: none;
  -webkit-user-drag: element;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.board-process-card[draggable="true"]:active {
  cursor: grabbing;
}

.board-process-card.dragging {
  opacity: 0.35;
  transform: scale(0.96);
  border: 2px dashed var(--md-sys-color-primary) !important;
  box-shadow: var(--elevation-3) !important;
}

.kanban-cards-container {
  transition: background-color 0.2s ease, outline 0.2s ease;
  min-height: 80px;
}

.kanban-cards-container.drag-over {
  background: rgba(99, 102, 241, 0.15) !important;
  border-radius: 12px;
  outline: 2px dashed var(--md-sys-color-primary) !important;
  outline-offset: -2px;
}

/* ==========================================================================
   ADEQUAÇÃO A MONITORES GRANDES E ULTRAWIDE (Ex: 2560x1080, 3440x1440, 4K)
   ========================================================================== */

@media (min-width: 1200px) {
  .app-container {
    max-width: 1380px;
  }
}

@media (min-width: 1800px), (min-aspect-ratio: 21/9) {
  .app-container {
    max-width: 95vw;
  }

  .kanban-board {
    min-width: 100%;
    width: 100%;
  }

  .kanban-column {
    max-width: none;
    flex: 1;
  }

  .process-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }
}

body.ultrawide-active .app-container {
  max-width: none !important;
  width: calc(100vw - 280px) !important;
  margin-left: 280px !important;
}

body.ultrawide-active .kanban-board-wrapper {
  max-width: 100%;
  overflow-x: auto;
}

body.ultrawide-active .kanban-board {
  min-width: 100% !important;
  width: 100% !important;
  gap: 20px !important;
}

body.ultrawide-active .kanban-column {
  max-width: none !important;
  flex: 1 !important;
  min-height: 480px !important;
}

body.ultrawide-active .process-grid {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)) !important;
  gap: 20px !important;
}

body.ultrawide-active .metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
}

/* ==========================================================================
   ESTILOS PARA FILTROS E CARDS DA ÁREA DE TAREFAS E PRAZOS
   ========================================================================== */
.tasks-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.task-filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: 20px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-plain);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  outline: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.task-filter-chip:hover {
  background: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface);
  border-color: var(--md-sys-color-outline);
  transform: translateY(-1px);
}

.task-filter-chip.active {
  background: var(--md-sys-color-primary) !important;
  color: #ffffff !important;
  border-color: var(--md-sys-color-primary) !important;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.task-filter-chip.chip-overdue {
  color: var(--md-sys-color-error);
  border-color: rgba(239, 68, 68, 0.35);
}

.task-filter-chip.chip-overdue:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.task-filter-chip.chip-overdue.active {
  background: var(--md-sys-color-error) !important;
  color: #ffffff !important;
  border-color: var(--md-sys-color-error) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* ==========================================================================
   BOTÃO FLUTUANTE PERSISTENTE DO WHATSAPP (FALE COM O DESENVOLVEDOR)
   ========================================================================== */
.floating-whatsapp-widget {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 99999 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 44px !important;
  max-width: 44px !important;
  padding: 0 11px !important;
  border-radius: 24px !important;
  background: #25D366 !important;
  color: #ffffff !important;
  text-decoration: none !important;
  font-family: var(--font-plain, 'Inter', sans-serif) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35) !important;
  transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s ease, box-shadow 0.25s ease, transform 0.25s ease, background-color 0.2s ease !important;
  cursor: pointer !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  opacity: 0.92 !important;
}

.floating-whatsapp-widget svg {
  flex-shrink: 0 !important;
  width: 22px !important;
  height: 22px !important;
}

.floating-whatsapp-widget span {
  opacity: 0 !important;
  max-width: 0 !important;
  margin-left: 0 !important;
  transition: opacity 0.25s ease 0.05s, max-width 0.35s ease, margin-left 0.25s ease !important;
  overflow: hidden !important;
  display: inline-block !important;
}

.floating-whatsapp-widget:hover {
  max-width: 240px !important;
  padding: 0 16px 0 12px !important;
  /* verde-escuro do WhatsApp: o texto branco precisa de 4,5:1 (no #20ba5a era 2:1) */
  background: #075E54 !important;
  opacity: 1 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.5) !important;
  color: #ffffff !important;
}

.floating-whatsapp-widget:hover span {
  opacity: 1 !important;
  max-width: 200px !important;
  margin-left: 8px !important;
}

/* ==========================================================================
   LAYOUT 1.1.22 — PAINEL LATERAL E ÁREA DE PROCESSOS
   ========================================================================== */
body.radar-app-active {
  display: block;
  background: #f5f7fb;
  color: #111827;
}

body.radar-app-active .app-container {
  --md-sys-color-primary: #4f46e5;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eef2ff;
  --md-sys-color-on-primary-container: #3730a3;
  --md-sys-color-background: #f5f7fb;
  --md-sys-color-on-background: #111827;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-on-surface: #111827;
  --md-sys-color-surface-variant: #f1f5f9;
  --md-sys-color-on-surface-variant: #64748b;
  --md-sys-color-outline: #94a3b8;
  --md-sys-color-outline-variant: #e2e8f0;
  width: calc(100dvw - 280px) !important;
  max-width: calc(100dvw - 280px) !important;
  min-height: 100vh;
  margin-left: 280px !important;
  margin-right: 0 !important;
  padding: 0 28px 70px;
  background: #f5f7fb;
  min-width: 0;
  overflow-x: clip;
}

body.radar-app-active .app-header {
  height: 98px;
  margin: 0 -28px 28px;
  padding: 0 32px;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(255,255,255,.96);
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
  position: sticky;
  top: 0;
  z-index: 90;
}

body.radar-app-active .app-page-heading {
  display: block;
  flex: 1;
}

body.radar-app-active .app-page-heading h2 {
  font-family: var(--font-brand);
  font-size: 27px;
  line-height: 1.15;
  color: #111827;
}

body.radar-app-active .app-page-heading p {
  color: #64748b;
  font-size: 13px;
  margin-top: 5px;
}

body.radar-app-active .header-brand {
  position: fixed;
  z-index: 99;
  left: 0;
  top: 0;
  width: 280px;
  height: 98px;
  padding: 0 24px;
  background: #101b4d;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

body.radar-app-active .brand-icon {
  padding: 10px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg,#6366f1,#4338ca);
  box-shadow: 0 8px 24px rgba(79,70,229,.38);
}

body.radar-app-active .brand-text h1 { color: #fff; font-size: 23px; }
body.radar-app-active .brand-text p { color: #a9b3d4; }

body.radar-app-active .dashboard-tabs {
  position: fixed;
  z-index: 98;
  left: 0;
  top: 98px;
  bottom: 0;
  width: 280px;
  margin: 0;
  padding: 22px 16px;
  border: 0;
  background: linear-gradient(180deg,#101b4d 0%,#0c1744 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  overflow-y: auto;
}

body.radar-app-active .dashboard-tabs .dash-tab-btn {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #cbd5e1;
  font-size: 14px;
  justify-content: flex-start;
  text-align: left;
}

body.radar-app-active .dashboard-tabs .dash-tab-btn:hover {
  color: #fff;
  background: rgba(99,102,241,.2);
}

body.radar-app-active .dashboard-tabs .dash-tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg,#4f46e5,#5b55df);
  border-color: rgba(255,255,255,.12);
  box-shadow: 0 8px 22px rgba(30,41,150,.32);
}

body.radar-app-active .dashboard-tabs .dash-tab-btn .material-symbols-rounded { font-size: 21px; }
body.radar-app-active .dashboard-tabs .sidebar-settings-btn { margin-top: 0; }

body.radar-app-active .main-content {
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
  gap: 24px;
}

body.radar-app-active .metrics-grid {
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 18px;
}

body.radar-app-active .metrics-card {
  min-height: 132px;
  padding: 22px 24px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(15,23,42,.05);
}

body.radar-app-active .metrics-card .card-icon {
  font-size: 30px;
  padding: 13px;
  border-radius: 50%;
}

body.radar-app-active .card-label { font-size: 13px; color: #64748b; }
body.radar-app-active .card-info h3 { font-size: 31px; margin-top: 3px; }

body.radar-app-active .dashboard-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 5px 22px rgba(15,23,42,.045);
  padding: 26px;
}

body.radar-app-active #section-dash-processes .section-header {
  margin-bottom: 22px !important;
}

body.radar-app-active #section-dash-processes .section-header > div:first-child {
  justify-content: space-between !important;
}

body.radar-app-active #section-dash-processes .section-header h2 {
  font-size: 25px;
  color: #111827;
}

body.radar-app-active #btn-add-process-header {
  order: 2;
  height: 46px !important;
  border-radius: 10px !important;
  box-shadow: 0 7px 18px rgba(79,70,229,.22);
}

body.radar-app-active .search-box {
  width: min(100%, 680px);
  max-width: 680px;
  height: 46px;
  border-radius: 10px;
  background: #fff;
}

body.radar-app-active .view-mode-selector {
  border-radius: 10px;
  background: #f8fafc;
}

body.radar-app-active .process-grid { gap: 0; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; }

@media (min-width: 1500px) {
  body.radar-app-active .app-container {
    padding-left: clamp(28px, 2.3vw, 52px);
    padding-right: clamp(28px, 2.3vw, 52px);
  }
  body.radar-app-active .main-content,
  body.radar-app-active .dashboard-section,
  body.radar-app-active .process-section,
  body.radar-app-active .process-grid {
    width: 100%;
    max-width: none;
  }
  body.radar-app-active .metrics-grid { gap: clamp(18px, 1.25vw, 30px); }
}

body.radar-app-active .process-card {
  display: grid;
  grid-template-columns: minmax(190px,.75fr) minmax(270px,1.15fr) minmax(230px,.82fr) minmax(150px,.5fr);
  align-items: center;
  gap: 22px;
  min-height: 116px;
  padding: 18px 22px;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0;
  box-shadow: none;
}

body.radar-app-active .process-card:last-child { border-bottom: 0; }
body.radar-app-active .process-card:hover { transform: none; background: #f8faff; border-color: #e5e7eb; }
body.radar-app-active .process-card-header { margin: 0; flex-direction: column; gap: 8px; }
body.radar-app-active .process-card-number { color: #3346d3; font-size: 15px; }
body.radar-app-active .process-card-details { margin: 0; gap: 7px; }
body.radar-app-active .process-card-details .detail-row { white-space: nowrap; overflow: hidden; }
body.radar-app-active .process-card-details .detail-row span:last-child { overflow: hidden; text-overflow: ellipsis; }
body.radar-app-active .process-card-details .detail-row:first-child { display: none; }
body.radar-app-active .process-card-footer {
  margin: 0;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 9px;
  text-align: right;
  color: #64748b;
  font-size: 12px;
}

body.radar-app-active .court-chip { border-radius: 7px; }

.process-post-it {
  position: relative;
  width: 220px;
  min-height: 142px;
  justify-self: center;
  padding: 23px 18px 14px;
  border: 1px solid #efd14d;
  border-radius: 2px 2px 12px 2px;
  background: linear-gradient(148deg, #fff477 0%, #ffe95b 72%, #eac33b 100%);
  box-shadow: 0 15px 19px rgba(82,58,3,.25), 5px 6px 0 rgba(194,151,20,.22);
  transform: rotate(-2deg);
  transition: transform .18s ease, box-shadow .18s ease;
  overflow: visible;
}

.process-post-it::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, rgba(145,101,5,.18) 0 49%, #fff7a4 51% 100%);
  box-shadow: -3px -3px 6px rgba(117,84,0,.16);
  pointer-events: none;
}

.process-post-it:focus-within {
  z-index: 2;
  transform: rotate(0) translateY(-2px);
  box-shadow: 0 12px 20px rgba(118,91,15,.24), 3px 5px 0 rgba(226,197,73,.35);
}

.process-post-it-top { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.process-post-it-pin {
  position: absolute;
  z-index: 4;
  top: -11px;
  left: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #a71919;
  background: radial-gradient(circle at 34% 28%, #ffb0a8 0 12%, #f0443e 28%, #c71919 72%, #991b1b 100%);
  box-shadow: 0 6px 6px rgba(127,29,29,.42), 0 0 0 3px rgba(153,27,27,.09);
  transform: translateX(-50%);
}
.process-post-it-pin::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 14px;
  width: 3px;
  height: 13px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg,#7f1d1d,#ef4444,#7f1d1d);
  box-shadow: 1px 2px 2px rgba(76,29,0,.24);
  transform: translateX(-50%) rotate(5deg);
}
.process-post-it-title { flex: 1; color: #725b10; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.process-post-it-delete {
  display: inline-flex;
  padding: 2px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #8b741f;
  cursor: pointer;
  opacity: .55;
}
.process-post-it-delete:hover { color: #b91c1c; background: rgba(255,255,255,.45); opacity: 1; }
.process-post-it-delete .material-symbols-rounded { font-size: 17px; }
.process-post-it-text {
  display: block;
  width: 100%;
  min-height: 73px;
  padding: 0 2px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #4b3d0b;
  text-align: center;
  font: 600 16px/1.38 "Segoe Print", "Bradley Hand", cursive;
}
.process-post-it-text::placeholder { color: #927d36; font-weight: 500; opacity: .76; }
.process-post-it-status { display: block; padding-top: 3px; color: #8b741f; font-size: 9px; opacity: .75; }

.movement-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fff1f2;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(220,38,38,.12);
}

.movement-alert-led {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fee2e2;
  box-shadow: 0 0 0 3px rgba(239,68,68,.16), 0 0 12px rgba(239,68,68,.85);
  animation: movementLedPulse 1.25s ease-in-out infinite;
}

@keyframes movementLedPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 3px rgba(239,68,68,.16), 0 0 12px rgba(239,68,68,.85);
  }
  50% {
    opacity: .65;
    transform: scale(.82);
    box-shadow: 0 0 0 1px rgba(239,68,68,.08), 0 0 4px rgba(239,68,68,.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .movement-alert-led { animation: none; }
}

@media (min-width: 1500px) {
  body.radar-app-active .process-card {
    grid-template-columns: minmax(230px,.8fr) minmax(360px,1.4fr) minmax(240px,.75fr) minmax(180px,.55fr);
  }
}

@media (max-width: 1050px) {
  body.radar-app-active .app-container {
    width: calc(100dvw - 232px) !important;
    max-width: calc(100dvw - 232px) !important;
    margin-left: 232px !important;
    margin-right: 0 !important;
    padding-left: 20px;
    padding-right: 20px;
  }
  body.radar-app-active.ultrawide-active .app-container {
    width: calc(100vw - 232px) !important;
    margin-left: 232px !important;
  }
  body.radar-app-active .header-brand,
  body.radar-app-active .dashboard-tabs { width: 232px; }
  body.radar-app-active .app-page-heading { display: none; }
  body.radar-app-active .header-actions { gap: 6px !important; min-width: 0; }
  body.radar-app-active #user-display-email { max-width: 120px !important; }
  body.radar-app-active .process-card { grid-template-columns: minmax(190px,.8fr) minmax(250px,1.2fr); }
  body.radar-app-active .process-post-it { grid-column: 1 / -1; width: min(100%, 360px); }
  body.radar-app-active .process-card-footer { grid-column: 1 / -1; justify-content: flex-start; text-align: left; }
}

@media (max-width: 768px) {
  html,
  body.radar-app-active {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }
  body.radar-app-active .app-container {
    width: 100dvw !important;
    max-width: 100dvw !important;
    min-width: 0;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 12px 100px;
    overflow-x: clip;
  }
  body.radar-app-active.ultrawide-active .app-container {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
  }
  body.radar-app-active .app-header {
    width: calc(100% + 24px);
    max-width: calc(100% + 24px);
    min-width: 0;
    height: auto;
    min-height: 72px;
    margin: 0 -12px 18px;
    padding: 10px 14px;
    flex-direction: row;
    align-items: center;
  }
  body.radar-app-active .header-actions {
    min-width: 0;
    max-width: 58%;
    overflow: hidden;
  }
  body.radar-app-active .header-actions > * {
    min-width: 0;
    max-width: 100%;
  }
  body.radar-app-active .main-content,
  body.radar-app-active .dashboard-section,
  body.radar-app-active .process-section,
  body.radar-app-active .finance-panel,
  body.radar-app-active .finance-insights-grid,
  body.radar-app-active .finance-overview-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  body.radar-app-active .finance-table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }
  body.radar-app-active .header-brand {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    border: 0;
  }
  body.radar-app-active .brand-icon { font-size: 20px; padding: 8px; }
  body.radar-app-active .brand-text { display: block; }
  body.radar-app-active .brand-text h1 { font-size: 18px; white-space: nowrap; color: var(--md-sys-color-on-background); }
  body.radar-app-active .brand-text p { display: none; }
  body.radar-app-active .app-page-heading h2 { font-size: 21px; }
  body.radar-app-active .app-page-heading p { display: none; }
  body.radar-app-active .header-actions > div:first-child { display: none !important; }
  body.radar-app-active .dashboard-tabs {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    height: 74px;
    padding: 8px 7px;
    flex-direction: row;
    justify-content: space-around;
    gap: 3px;
    overflow: hidden;
    background: #101b4d;
  }
  body.radar-app-active .dashboard-tabs .dash-tab-btn {
    min-width: 0;
    width: auto;
    flex: 1;
    height: 58px;
    min-height: 58px;
    padding: 5px 3px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    border-radius: 9px;
    font-size: 9px;
    white-space: normal;
    text-align: center;
  }
  body.radar-app-active .dashboard-tabs .sidebar-settings-btn { margin-top: 0; }
  body.radar-app-active .metrics-grid { grid-template-columns: 1fr; gap: 10px; }
  body.radar-app-active .metrics-card { min-height: 86px; padding: 13px 16px; }
  body.radar-app-active .metrics-card .card-icon { font-size: 24px; padding: 10px; }
  body.radar-app-active .card-info h3 { font-size: 24px; }
  body.radar-app-active .dashboard-section { padding: 16px; border-radius: 14px; }
  body.radar-app-active #section-dash-processes .section-header > div:first-child { align-items: stretch !important; }
  body.radar-app-active #btn-add-process-header span:last-child { display: none; }
  body.radar-app-active .process-grid { border: 0; overflow: visible; gap: 10px; }
  body.radar-app-active .process-card {
    display: flex;
    min-height: 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    gap: 10px;
  }
  body.radar-app-active .process-card-header { flex-direction: row; }
  body.radar-app-active .process-card-footer {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }
  .movement-alert { padding: 7px 10px; font-size: 11px; }
}

@media (max-width: 600px) {
  .floating-whatsapp-widget {
    width: 50px !important;
    height: 50px !important;
    bottom: 88px !important;
    right: 12px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: 50% !important;
}
  .floating-whatsapp-widget span { display: none !important; }
  .floating-whatsapp-widget svg { width: 25px !important; height: 25px !important; }
}

/* ==========================================================================
   TOASTS / NOTIFICAÇÕES (SNACKBAR M3 - TOP-RIGHT NÃO-OBSTRUTIVO)
   ========================================================================== */

.snackbar-container {
  position: fixed;
  top: 24px;
  right: 24px;
  left: auto;
  bottom: auto;
  transform: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99999;
  width: 90%;
  max-width: 380px;
  pointer-events: none;
}

.snackbar {
  background: rgba(24, 24, 27, 0.95);
  color: #f4eff4;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
  cursor: pointer;
  animation: slideDownToast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.snackbar:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

@keyframes slideDownToast {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.snackbar-text {
  flex-grow: 1;
  font-weight: 500;
  color: #f1f5f9;
}

.snackbar-action {
  border: none;
  background: rgba(208, 188, 255, 0.12);
  color: #d0bcff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.snackbar-action:hover {
  background-color: rgba(208, 188, 255, 0.25);
  color: #fff;
}

@media (max-width: 640px) {
  .snackbar-container {
    top: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }
}

/* ==========================================================================
   GERENCIAMENTO DE EQUIPE E LOGS DE AUDITORIA
   ========================================================================== */

.team-counter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.team-member-card {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.team-member-card:hover {
  transform: translateY(-2px);
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.team-member-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-member-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--md-sys-color-primary), #6366f1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}

.team-member-info h5 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.team-member-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.team-perm-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.team-perm-allowed {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.team-perm-blocked {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.audit-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.audit-badge-login { background: #e0e7ff; color: #3730a3; }
.audit-badge-create { background: #dcfce7; color: #166534; }
.audit-badge-edit { background: #e0f2fe; color: #0369a1; }
.audit-badge-delete { background: #fee2e2; color: #991b1b; }
.audit-badge-ai { background: #f3e8ff; color: #6b21a8; }
.audit-badge-member { background: #fef3c7; color: #92400e; }
.audit-badge-default { background: #f1f5f9; color: #475569; }

@media (prefers-color-scheme: dark) {
  .audit-badge-login { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
  .audit-badge-create { background: rgba(34, 197, 94, 0.2); color: #86efac; }
  .audit-badge-edit { background: rgba(14, 165, 233, 0.2); color: #7dd3fc; }
  .audit-badge-delete { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
  .audit-badge-ai { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
  .audit-badge-member { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
  .audit-badge-default { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
}

[data-theme="dark"] .audit-badge-login { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
[data-theme="dark"] .audit-badge-create { background: rgba(34, 197, 94, 0.2); color: #86efac; }
[data-theme="dark"] .audit-badge-edit { background: rgba(14, 165, 233, 0.2); color: #7dd3fc; }
[data-theme="dark"] .audit-badge-delete { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
[data-theme="dark"] .audit-badge-ai { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
[data-theme="dark"] .audit-badge-member { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
[data-theme="dark"] .audit-badge-default { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

/* ==========================================================================
   SISTEMA GLOBAL DE TOOLTIPS FLUTUANTES (DESCRITIVOS & SUTIS)
   ========================================================================== */
.rp-tooltip {
  position: fixed;
  z-index: 999999;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  font-family: var(--font-body, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: 270px;
  text-align: center;
  word-wrap: break-word;
  white-space: normal;
  opacity: 0;
  transform: translateY(3px) scale(0.97);
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.rp-tooltip.rp-tooltip-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

[data-theme="light"] .rp-tooltip,
:root:not([data-theme="dark"]) .rp-tooltip {
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .rp-tooltip {
  background: rgba(10, 15, 30, 0.96);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 12px 28px -2px rgba(0, 0, 0, 0.6);
}

.rp-tooltip kbd {
  display: inline-block;
  padding: 1px 4px;
  font-size: 10px;
  font-family: monospace;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  margin-left: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ========================================================
   SUÍTE DE FERRAMENTAS DO PERITO & ASSISTENTE TÉCNICO
   ======================================================== */

.memorial-hours-container {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
  margin-bottom: 14px;
}

.memorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.memorial-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.memorial-input-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}

.memorial-input-group input,
.memorial-input-group select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-size: 13px;
  font-weight: 600;
  box-sizing: border-box;
}

.memorial-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}

.memorial-summary-bar .total-value {
  font-size: 17px;
  font-family: var(--font-mono);
}

/* Radar de Alvarás e Depósitos */
.alvara-radar-section {
  margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(6, 95, 70, 0.03));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 14px;
  padding: 18px 20px;
}

.alvara-radar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.alvara-radar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #10b981;
}

.alvara-radar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.alvara-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 10px;
  transition: border-color 0.15s ease;
}

.alvara-item-card:hover {
  border-color: #10b981;
}

.alvara-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.alvara-badge.badge-alvara {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.alvara-badge.badge-mle {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.alvara-badge.badge-deposito {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.alvara-badge.badge-rpv {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

/* Checador de Diligência CPC 466 */
.diligence-warning-box {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.diligence-warning-box.success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.diligence-warning-box.warning {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* Modal Calculadora Forense */
.calc-result-panel {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.calc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--md-sys-color-outline-variant);
}

.calc-result-row:last-child {
  border-bottom: none;
}

.calc-result-row.highlight {
  font-size: 16px;
  font-weight: 800;
  color: var(--md-sys-color-primary);
  padding-top: 10px;
}



/* Tutoriais em vídeo: link "Aprenda a usar esta tarefa" com o logo do YouTube */
.yt-learn { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap; vertical-align: middle; text-decoration: none; color: var(--md-sys-color-on-surface); background: rgba(255, 0, 51, 0.08); border: 1px solid rgba(255, 0, 51, 0.3); transition: background 0.2s; }
.yt-learn:hover { background: rgba(255, 0, 51, 0.16); }
.yt-learn[hidden] { display: none; }
.yt-learn svg { flex: none; }
.dialog-title-group:has(.yt-learn) { flex-wrap: wrap; row-gap: 6px; }
.dialog-title-group:has(.yt-learn) h3 { white-space: nowrap; }

/* Abas Laudo (quesitos) e Despesas — js/laudo-despesas.js */
.lp-aviso { background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.2); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; font-size: 13px; line-height: 1.55; }
.lp-aviso-sub { margin-top: 8px; color: var(--md-sys-color-on-surface-variant); }
.lp-acoes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.lp-status { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.lp-colar { margin-bottom: 14px; font-size: 12px; }
.lp-colar textarea, .lq-resposta { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface); font-family: inherit; font-size: 13px; line-height: 1.5; resize: vertical; margin-top: 6px; }
.lp-card { padding: 14px 16px; border-radius: 12px; background: var(--md-sys-color-surface-container); border: 1px solid var(--md-sys-color-outline-variant); margin-bottom: 14px; }
.lq-grupo { font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--md-sys-color-primary); margin: 18px 0 8px; }
.lq-item { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface-container-low, var(--md-sys-color-surface)); margin-bottom: 10px; }
.lq-cab { display: flex; gap: 8px; align-items: flex-start; }
.lq-num { flex: none; font-weight: 700; color: var(--md-sys-color-primary); min-width: 26px; }
.lq-texto { flex: 1; font-size: 13px; line-height: 1.5; }
.lq-item .md-btn-icon { width: 28px; height: 28px; flex: none; }
.ld-tabela { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.ld-tabela th, .ld-tabela td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--md-sys-color-outline-variant); vertical-align: middle; }
.ld-tabela td.ld-valor, .ld-tabela th.ld-valor { text-align: right; white-space: nowrap; }
@media (max-width: 640px) { .ld-tabela .ld-col-cat, .ld-tabela .ld-col-local { display: none; } }
.lp-acoes[hidden], #btn-instalar-app[hidden] { display: none !important; }
.ld-tabela .md-btn-icon { display: inline-flex; vertical-align: middle; }
#btn-md-remover[hidden] { display: none !important; }
