/*
 * Estilos Principais - BP Bioenergy Mindmap
 * Implementação da Identidade Visual descrita em estilo.md
 */

/* Importar fontes premium do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
  /* Variáveis Padrão (Modo Claro Corporativo) */
  --bg-primary: #f4f6f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8fafc;
  --bg-overlay: rgba(255, 255, 255, 0.9);
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-subject: #334155;
  
  --color-highlight: #004f00;
  --color-link: #0284c7;
  --color-link-hover: #004f00;
  
  --node-active-text: #ffffff;
  
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --card-hover-bg: #f8fafc;
  --shadow: rgba(0, 0, 0, 0.1);
  
  --font-family-title: 'Outfit', sans-serif;
  --font-family-body: 'Inter', sans-serif;
  
  --transition-speed: 0.3s;
}

[data-theme="dark"] {
  /* Variáveis para Modo Escuro */
  --bg-primary: #0b0f13;
  --bg-secondary: #131920;
  --bg-tertiary: #1b222c;
  --bg-overlay: rgba(11, 15, 19, 0.85);
  
  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --text-subject: #ffffff;
  
  --color-highlight: #8bff00;
  --color-link: #6bbaef;
  --color-link-hover: #8bff00;
  
  --node-active-text: #0b0f13;
  
  --border-color: #2a3644;
  --card-bg: #161f2b;
  --card-hover-bg: #1f2c3d;
  --shadow: rgba(0, 0, 0, 0.4);
}

/* Estilos de Reset e Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

body {
  font-family: var(--font-family-body);
  background-color: var(--bg-primary);
  background-image: url('bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text-primary);
  font-size: 16pt; /* Definido pelo estilo.md para corpo de texto */
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 3px;
}

/* Layout Geral */
header {
  height: 70px;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  z-index: 10;
  transition: background-color var(--transition-speed), border-color var(--transition-speed);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  position: relative;
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-symbol {
  width: 32px;
  height: 32px;
  background: radial-gradient(circle, var(--color-highlight) 30%, var(--color-link) 100%);
  border-radius: 50%;
  animation: pulse 3s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(139, 255, 0, 0.4); }
  100% { transform: scale(1.08); box-shadow: 0 0 12px 4px rgba(139, 255, 0, 0.1); }
}

.title-container h1 {
  font-family: var(--font-family-title);
  font-size: 20pt;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.title-container p {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-secondary);
  margin-top: -2px;
}

.controls-area {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Campo de Busca Flutuante */
.floating-search {
  position: fixed;
  top: 16px;
  right: 80px;
  z-index: 1000;
  display: flex;
  align-items: center;
}

.search-input {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-family: var(--font-family-body);
  font-size: 14px;
  padding: 10px 18px;
  padding-left: 38px;
  border-radius: 24px;
  width: 280px;
  transition: width var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
  width: 350px;
  outline: none;
  border-color: rgba(139, 255, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(139, 255, 0, 0.15);
}

.floating-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  font-size: 14px;
}

/* Botão de Tema */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-speed), border-color var(--transition-speed);
  width: 38px;
  height: 38px;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--color-highlight);
}

/* Main Container (Grafo + Painéis) */
.main-wrapper {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}



/* Área de Visualização do Grafo */
.graph-container {
  flex: 1;
  position: relative;
  background-color: transparent;
  transition: background-color var(--transition-speed);
}

.graph-svg {
  width: 100%;
  height: 100%;
  cursor: grab;
}

.graph-svg:active {
  cursor: grabbing;
}

/* Elementos SVG do Grafo */
.edge-path {
  fill: none;
  stroke: var(--color-link);
  stroke-opacity: 0.35;
  stroke-width: 2px;
  transition: stroke var(--transition-speed), stroke-opacity var(--transition-speed), stroke-width var(--transition-speed);
}

.edge-path.highlighted {
  stroke-opacity: 0.95;
  stroke-width: 3px;
  stroke: var(--color-highlight);
}

.node-group {
  cursor: pointer;
}

.node-rect {
  fill: #ffffff;
  stroke: #e2e8f0;
  stroke-width: 1.5px;
  rx: 10px;
  ry: 10px;
  transition: fill var(--transition-speed), stroke var(--transition-speed), stroke-width 0.2s, filter 0.2s;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
}

.node-group:hover .node-rect {
  stroke: #8bff00;
  stroke-width: 2.5px;
  fill: #ffffff;
  filter: drop-shadow(0 6px 16px rgba(139, 255, 0, 0.35));
}

.node-group.active .node-rect {
  fill: #8bff00;
  stroke: #ffffff;
  stroke-width: 2.5px;
  filter: drop-shadow(0 0 20px rgba(139, 255, 0, 0.8));
}

.node-label {
  font-family: var(--font-family-title);
  font-size: 11pt;
  font-weight: 600;
  fill: #1a202c;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  transition: fill var(--transition-speed);
}

.node-group:hover .node-label {
  fill: #004f00;
}

.node-group.active .node-label {
  fill: #003300;
  font-weight: 700;
}

/* Card de Detalhes Flutuante (Direita) */
.details-panel {
  position: absolute;
  top: 30px;
  right: 30px;
  bottom: 30px;
  width: 60vw; /* Ocupa a maior parte da tela (60% da largura) */
  max-width: calc(100% - 360px); /* Garante pelo menos 360px de área livre à esquerda para o mapa mental */
  min-width: 520px;
  height: calc(100% - 60px);
  background-color: var(--bg-secondary); /* Fundo sólido para evitar que linhas do grafo fiquem atrás do texto */
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  z-index: 8;
  transform: translateX(50px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease, background-color var(--transition-speed), border-color var(--transition-speed);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.details-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--color-highlight), var(--color-link));
  z-index: 9;
}

.details-panel.open {
  transform: translateX(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

.details-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.header-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 280px;
}

.header-search .search-input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-family-body);
  font-size: 13px;
  padding: 8px 14px 8px 34px;
  border-radius: 20px;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.header-search .search-input::placeholder {
  color: var(--text-secondary);
}

.header-search .search-input:focus {
  width: 100%;
  outline: none;
  border-color: var(--color-highlight);
  box-shadow: 0 0 0 3px rgba(139, 255, 0, 0.15);
}

.header-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 13px;
}

.close-panel-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}

.close-panel-btn:hover {
  border-color: var(--color-highlight);
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

.details-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

.details-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
}

.placeholder-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

/* Formatação do Conteúdo Interno do Painel de Detalhes */
.topic-header {
  margin-bottom: 20px;
}

.topic-header h2 {
  font-family: var(--font-family-title);
  font-size: 20pt;
  font-weight: 700;
  margin-top: 8px;
  letter-spacing: -0.5px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge-rotina { background-color: rgba(107, 186, 239, 0.12); color: #6bbaef; border: 1px solid rgba(107, 186, 239, 0.2); }
.badge-governanca { background-color: rgba(255, 140, 0, 0.12); color: #ff8c00; border: 1px solid rgba(255, 140, 0, 0.2); }
.badge-melhoria { background-color: rgba(139, 255, 0, 0.12); color: var(--color-highlight); border: 1px solid rgba(139, 255, 0, 0.2); }
.badge-operacoes { background-color: rgba(217, 232, 245, 0.12); color: var(--color-link); border: 1px solid rgba(217, 232, 245, 0.2); }
.badge-seguranca { background-color: rgba(220, 20, 60, 0.12); color: #ff4d4d; border: 1px solid rgba(220, 20, 60, 0.2); }

/* Highlight de Copywriting Visual (Seção 3 do estilo.md) */
.message-highlight {
  background-color: var(--bg-primary);
  border-left: 4px solid var(--color-highlight);
  padding: 18px 22px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 26px;
  font-size: 13pt;
  line-height: 1.6;
  box-shadow: inset 2px 2px 10px rgba(0,0,0,0.05);
}

.highlight-subject {
  color: var(--text-subject);
  font-weight: 400;
  transition: color var(--transition-speed);
}

.highlight-insight {
  color: var(--color-highlight);
  font-weight: 600;
  display: block;
  margin-top: 6px;
  transition: color var(--transition-speed);
}

/* Tabelas e Hierarquias */
.details-body h3 {
  font-family: var(--font-family-title);
  font-size: 14pt;
  margin-top: 32px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  color: var(--text-primary);
}

.details-body h4 {
  font-family: var(--font-family-title);
  font-size: 12pt;
  margin-top: 20px;
  margin-bottom: 10px;
}

.details-body p {
  font-size: 11pt;
  color: var(--text-secondary);
  margin-bottom: 18px;
  line-height: 1.6;
}

.details-body ul, .details-body ol {
  padding-left: 22px;
  margin-bottom: 20px;
}

.details-body li {
  font-size: 11pt;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.details-body strong {
  color: var(--text-primary);
}

/* Tabelas Acessíveis Modificadas para Melhor Enquadramento */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 20px 0 26px 0;
  font-size: 10pt;
  text-align: left;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  line-height: 1.4;
}

.data-table th:last-child, .data-table td:last-child {
  border-right: none;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table th {
  background-color: var(--bg-tertiary);
  font-family: var(--font-family-title);
  font-weight: 600;
  color: var(--text-primary);
}

.data-table tbody tr:hover {
  background-color: rgba(139, 255, 0, 0.02);
}

/* Cores das células da matriz RASCI */
.cell-r { font-weight: 600; color: #6bbaef; }
.cell-a { font-weight: 600; color: var(--color-highlight); }
.cell-c { font-weight: 500; color: #ff8c00; }
.cell-i { font-weight: 400; color: var(--text-secondary); }

/* Listas de Processo customizadas */
.process-list li {
  list-style-type: none;
  position: relative;
  padding-left: 28px;
  margin-bottom: 18px;
}

.process-list li::before {
  content: counter(section);
  counter-increment: section;
  position: absolute;
  left: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--color-highlight);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
}
.process-list {
  counter-reset: section;
}

/* Cards de Troubleshooting Modificados */
.trouble-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.card-item {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px;
  transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.card-item:hover {
  border-color: var(--color-highlight);
  transform: translateY(-2px);
}

.card-item h4 {
  margin-top: 0;
  color: var(--color-link);
  font-size: 11pt;
  margin-bottom: 10px;
}

/* Rodapé Institucional */
footer {
  height: 40px;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-body);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
  z-index: 10;
  transition: background-color var(--transition-speed), border-color var(--transition-speed), color var(--transition-speed);
}

.footer-divider {
  margin: 0 12px;
  color: var(--border-color);
}

/* Instruções Rápidas Overlay */
.instructions-overlay {
  position: absolute;
  bottom: 24px;
  left: 30px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 20px;
  border-radius: 24px; /* Formato cápsula (capsule pill) */
  font-size: 11px;
  color: var(--text-secondary);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 4;
}

.instructions-overlay ul {
  list-style: none;
  display: flex;
  gap: 16px;
}

.instructions-overlay li {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Ajustes de Acessibilidade */
.btn-accessibility {
  border: 1px dashed var(--border-color);
}

/* Links interativos dentro do card de detalhes */
.node-link {
  color: var(--color-link);
  text-decoration: none;
  border-bottom: 1px dashed rgba(107, 186, 239, 0.4);
  transition: color var(--transition-speed), border-color var(--transition-speed);
  cursor: pointer;
}

.node-link:hover {
  color: var(--color-highlight);
  border-bottom: 1px solid var(--color-highlight);
}

/* Widget de Preview do Calendário Semanal (Detalhes da Agenda) */
.calendar-preview-widget {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0 26px 0;
  cursor: pointer;
  transition: transform 0.2s, border-color var(--transition-speed), box-shadow 0.2s;
}

.calendar-preview-widget:hover {
  transform: translateY(-2px);
  border-color: var(--color-highlight);
  box-shadow: 0 8px 24px rgba(139, 255, 0, 0.1);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-family: var(--font-family-title);
  font-size: 11pt;
  font-weight: 600;
  color: var(--text-primary);
}

.zoom-hint {
  font-size: 9pt;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.preview-day-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p-day {
  font-size: 9pt;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.p-meeting {
  font-size: 8pt;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 6px;
  text-align: center;
  display: block;
}

/* Backgrounds para o preview do calendário */
.gsi-bg { background-color: rgba(107, 186, 239, 0.15); color: #6bbaef; }
.prog-bg { background-color: rgba(255, 140, 0, 0.15); color: #ff8c00; }
.proc-bg { background-color: rgba(139, 255, 0, 0.12); color: var(--color-highlight); }
.conf-bg { background-color: rgba(200, 100, 255, 0.15); color: #c864ff; }
.pspi-bg { background-color: rgba(0, 200, 150, 0.15); color: #00c896; }

/* Modal de Calendário Semanal Fullscreen */
.calendar-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(11, 15, 19, 0.85);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.calendar-modal.open {
  opacity: 1;
  pointer-events: all;
  z-index: 99999 !important;
}

.calendar-modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 90vw;
  max-width: 1200px;
  height: 85vh;
  max-height: 800px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.calendar-modal.open .calendar-modal-content {
  transform: scale(1);
}

.calendar-modal-header {
  padding: 20px 30px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-tertiary);
  position: relative;
}

.calendar-modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-highlight), var(--color-link));
}

.calendar-modal-header h2 {
  font-family: var(--font-family-title);
  font-size: 16pt;
  margin: 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-calendar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18pt;
  cursor: pointer;
  transition: color var(--transition-speed), transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.close-calendar-btn:hover {
  color: var(--text-primary);
  background-color: var(--border-color);
  transform: scale(1.05);
}

.calendar-modal-body {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  background-color: var(--bg-primary);
}

/* Grade Horária do Calendário Semanal */
.large-calendar-grid {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 0;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  height: 600px;
  background-color: var(--bg-secondary);
}

.time-axis {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  padding-top: 40px;
}

.time-label {
  height: 60px; /* 1 hora = 60px */
  font-size: 8.5pt;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
}

.calendar-days-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  height: 100%;
}

.day-track {
  position: relative;
  border-right: 1px solid var(--border-color);
  background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 60px; /* 1 hora = 60px */
  height: 100%;
}

.day-track:last-child {
  border-right: none;
}

.track-header {
  height: 40px;
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-title);
  font-size: 9.5pt;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.events-content-area {
  position: relative;
  height: 540px;
  width: 100%;
}

/* Event Cards dentro da Grade do Calendário */
.events-content-area .event-card {
  position: absolute;
  border-radius: 6px;
  padding: 6px 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
  border-left: 3px solid transparent;
  overflow: hidden;
  z-index: 2;
}

.events-content-area .event-card:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  filter: brightness(1.15);
  z-index: 10; /* Traz para a frente no hover */
}

.events-content-area .event-time {
  font-family: var(--font-family-mono);
  font-size: 7.5pt;
  font-weight: 700;
  opacity: 0.8;
  margin-bottom: 2px;
  white-space: nowrap;
}

.events-content-area .event-time i {
  margin-right: 2px;
}

.events-content-area .event-title {
  font-family: var(--font-family-title);
  font-size: 8.5pt;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.events-content-area .event-desc {
  font-size: 7.5pt;
  opacity: 0.75;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Evento LT (Modo Escuro) */
.event-lt {
  background-color: rgba(107, 186, 239, 0.08);
  border: 1px solid rgba(107, 186, 239, 0.15);
  border-left-color: #6bbaef !important;
  color: #a5d8ff;
}

/* Estilização individual dos cards de evento (Modo Escuro) */
.event-gsi {
  background-color: rgba(107, 186, 239, 0.12);
  border: 1px solid rgba(107, 186, 239, 0.25);
  border-left-color: #6bbaef;
  color: #a5d8ff;
}
.event-prog {
  background-color: rgba(255, 140, 0, 0.12);
  border: 1px solid rgba(255, 140, 0, 0.25);
  border-left-color: #ff8c00;
  color: #ffc27d;
}
.event-proc {
  background-color: rgba(139, 255, 0, 0.1);
  border: 1px solid rgba(139, 255, 0, 0.18);
  border-left-color: var(--color-highlight);
  color: #d1ff9e;
}
.event-conf {
  background-color: rgba(200, 100, 255, 0.12);
  border: 1px solid rgba(200, 100, 255, 0.25);
  border-left-color: #c864ff;
  color: #ebc4ff;
}
.event-pspi {
  background-color: rgba(0, 200, 150, 0.12);
  border: 1px solid rgba(0, 200, 150, 0.25);
  border-left-color: #00c896;
  color: #8effe2;
}

/* Sobrescrita de contraste no tema claro para os Cards de Evento e Cabeçalhos */
[data-theme="light"] .time-label {
  color: #333333 !important;
}
[data-theme="light"] .track-header {
  color: #1a1a1a !important;
}
[data-theme="light"] .event-lt {
  background-color: rgba(0, 86, 179, 0.08) !important;
  border: 1px solid rgba(0, 86, 179, 0.15) !important;
  border-left-color: #0056b3 !important;
  color: #003366 !important;
}
[data-theme="light"] .event-gsi {
  background-color: rgba(0, 86, 179, 0.08) !important;
  border: 1px solid rgba(0, 86, 179, 0.15) !important;
  border-left-color: #0056b3 !important;
  color: #003366 !important;
}
[data-theme="light"] .event-prog {
  background-color: rgba(211, 84, 0, 0.08) !important;
  border: 1px solid rgba(211, 84, 0, 0.15) !important;
  border-left-color: #d35400 !important;
  color: #782800 !important;
}
[data-theme="light"] .event-proc {
  background-color: rgba(0, 79, 0, 0.06) !important;
  border: 1px solid rgba(0, 79, 0, 0.12) !important;
  border-left-color: #004f00 !important;
  color: #003600 !important;
}
[data-theme="light"] .event-conf {
  background-color: rgba(111, 66, 193, 0.08) !important;
  border: 1px solid rgba(111, 66, 193, 0.15) !important;
  border-left-color: #6f42c1 !important;
  color: #3b1470 !important;
}
[data-theme="light"] .event-pspi {
  background-color: rgba(0, 143, 107, 0.08) !important;
  border: 1px solid rgba(0, 143, 107, 0.15) !important;
  border-left-color: #008f6b !important;
  color: #004d39 !important;
}

.calendar-modal-footer {
  padding: 15px 30px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
}

.calendar-modal-footer p {
  margin: 0;
  font-size: 10pt;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Estilos do Guia de Boas-Vindas do Usuário */
.welcome-guide {
  animation: fadeInWelcome 0.4s ease-out;
}

.guide-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.guide-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 14px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.guide-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-highlight);
  box-shadow: 0 8px 20px rgba(139, 255, 0, 0.08);
}

.guide-card-icon {
  font-size: 18pt;
  color: var(--color-highlight);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 24px;
}

.guide-card-body h4 {
  margin: 0 0 6px 0;
  font-size: 11pt;
  font-weight: 600;
  color: var(--text-primary);
}

.guide-card-body p {
  margin: 0;
  font-size: 9.5pt;
  color: var(--text-secondary);
  line-height: 1.4;
}

.guide-footer-badge {
  text-align: center;
  font-size: 9pt;
  color: var(--text-secondary);
  border-top: 1px dashed var(--border-color);
  padding-top: 15px;
  margin-top: 25px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

/* Tooltip do Calendário (Hover Detalhado) */
.calendar-tooltip {
  position: absolute;
  z-index: 9999;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  max-width: 290px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  pointer-events: none; /* Não atrapalha cliques ou outras interações */
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calendar-tooltip.visible {
  opacity: 1;
}

.calendar-tooltip .tooltip-time {
  font-family: var(--font-family-mono);
  font-size: 8pt;
  font-weight: 700;
  color: var(--color-highlight);
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-tooltip .tooltip-title {
  font-family: var(--font-family-title);
  font-size: 9.5pt;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.calendar-tooltip .tooltip-desc {
  font-size: 8.5pt;
  color: var(--text-secondary);
  line-height: 1.35;
}

.calendar-tooltip .tooltip-action {
  font-size: 7.5pt;
  color: var(--color-link);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

/* Ajustes de contraste para Tooltip no Modo Claro */
[data-theme="light"] .calendar-tooltip {
  background-color: #ffffff !important;
  border-color: #d1d5db !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .calendar-tooltip .tooltip-time {
  color: #0056b3 !important;
}

[data-theme="light"] .calendar-tooltip .tooltip-action {
  color: #0056b3 !important;
}

/* ==========================================================================
   ESTILOS DO FLUXO ORGANOGRAMA INTERATIVO (COLLAPSIBLE ORG TREE)
   ========================================================================== */
.org-flow-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
  position: relative;
  padding-left: 10px;
}

/* Linha vertical que conecta o fluxo */
.org-flow-container::before {
  content: '';
  position: absolute;
  left: 25px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background-color: var(--border-color);
  z-index: 1;
}

/* Nó do Fluxograma (Estilo de Cartão Interativo) */
.org-flow-node {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  margin-left: 30px;
  position: relative;
  transition: all 0.2s ease-in-out;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 2;
}

/* Indicadores de conexão horizontal */
.org-flow-node::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 50%;
  width: 30px;
  height: 2px;
  background-color: var(--border-color);
  z-index: 1;
}

.org-flow-node:hover {
  border-color: var(--color-highlight);
  box-shadow: 0 4px 12px rgba(139, 255, 0, 0.12);
  transform: translateX(2px);
}

/* Nó Raiz (Liderança do Fluxo) */
.root-node {
  background-color: rgba(139, 255, 0, 0.04);
  border-color: rgba(139, 255, 0, 0.3);
  margin-left: 0;
  box-shadow: 0 4px 12px rgba(139, 255, 0, 0.05);
}
.root-node::before {
  display: none; /* Raiz não tem linha esquerda */
}
.root-node .node-title {
  font-size: 13pt;
  font-weight: 700;
  color: var(--text-primary);
}

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

.node-title {
  font-family: var(--font-family-title);
  font-weight: 600;
  font-size: 11pt;
  color: var(--text-primary);
}

.node-subtitle {
  font-size: 9pt;
  color: var(--text-secondary);
}

.node-badge {
  font-size: 8pt;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: rgba(107, 186, 239, 0.12);
  color: #6bbaef;
  border: 1px solid rgba(107, 186, 239, 0.2);
  font-weight: 600;
}

/* Estilo para Ramificação Collapsible (details) */
.org-flow-branch {
  display: flex;
  flex-direction: column;
  position: relative;
}

.org-flow-branch summary {
  list-style: none; /* Remove seta padrão */
  outline: none;
  cursor: pointer;
}
.org-flow-branch summary::-webkit-details-marker {
  display: none; /* Remove seta padrão no Safari */
}

/* Efeito de abertura nos ramos */
.org-flow-branch summary .org-flow-node {
  cursor: pointer;
}

/* Adiciona seta personalizada no canto direito do cartão summary */
.org-flow-branch summary .org-flow-node::after {
  content: '\f107'; /* fa-chevron-down */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10pt;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  margin-left: 12px;
}

.org-flow-branch[open] summary .org-flow-node::after {
  transform: rotate(180deg);
  color: var(--color-highlight);
}

/* Conteúdo interno da ramificação */
.branch-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding-left: 30px;
  position: relative;
}

/* Linha guia vertical secundária para filhos */
.branch-content::before {
  content: '';
  position: absolute;
  left: 5px; /* Alinha com a linha do contêiner pai */
  top: -10px;
  bottom: 25px;
  width: 2px;
  background-color: var(--border-color);
  z-index: 1;
}

.branch-content .org-flow-node {
  margin-left: 0px;
}
.branch-content .org-flow-node::before {
  left: -25px;
  width: 25px;
}

/* Nós folhas (sem filhos) */
.leaf-node {
  border-left: 3px solid var(--color-link);
}

/* Diferenciação de cores para áreas */
.area-processos { border-left: 4px solid var(--color-highlight); }
.area-producao { border-left: 4px solid #ff8c00; }
.area-manutencao { border-left: 4px solid #c864ff; }
.area-eia { border-left: 4px solid #6bbaef; }

/* Adaptações para Modo Claro */
[data-theme="light"] .org-flow-node {
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
[data-theme="light"] .root-node {
  background-color: rgba(139, 255, 0, 0.02);
}
[data-theme="light"] .node-badge {
  background-color: rgba(0, 86, 179, 0.06);
  color: #0056b3;
  border-color: rgba(0, 86, 179, 0.1);
}

/* ==========================================================================
   WIDGET DE PREVIEW DO ORGANOGRAMA & ÁRVORE HIERÁRQUICA (TOP-DOWN)
   ========================================================================== */
.organograma-preview-widget {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0 24px 0;
  cursor: pointer;
  transition: transform 0.2s ease, border-color var(--transition-speed), box-shadow 0.2s ease;
  position: relative;
}

.organograma-preview-widget:hover {
  transform: translateY(-2px);
  border-color: var(--color-highlight);
  box-shadow: 0 8px 24px rgba(139, 255, 0, 0.12);
}

.org-mini-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 16px 0;
  padding: 14px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  user-select: none;
}

.org-mini-node {
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 8.5pt;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.org-mini-blue { background-color: #1c5276; min-width: 170px; }
.org-mini-red { background-color: #900c3f; min-width: 150px; }
.org-mini-orange { background-color: #d35400; padding: 4px 10px; font-size: 8pt; }

.org-mini-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.org-mini-green { background-color: #27ae60; font-size: 7.5pt; padding: 3px 8px; }

.org-mini-line {
  width: 2px;
  height: 8px;
  background-color: var(--text-secondary);
  opacity: 0.5;
}

.zoom-hint-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background-color: rgba(139, 255, 0, 0.08);
  border: 1px solid var(--color-highlight);
  border-radius: 8px;
  color: var(--color-highlight);
  font-weight: 600;
  font-size: 9.5pt;
  margin-top: 12px;
  transition: background-color 0.2s, color 0.2s;
}

.organograma-preview-widget:hover .zoom-hint-btn {
  background-color: var(--color-highlight);
  color: #000000;
}

/* Árvore Organograma Top-Down Fullscreen (Estilo idêntico à imagem enviada) */
.tree-organogram-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 980px;
  padding: 24px 12px;
  user-select: none;
}

.tree-root-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tree-card {
  border-radius: 6px;
  padding: 10px 8px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  width: 180px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tree-card:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

.tree-card .card-role {
  font-family: var(--font-family-title);
  font-weight: 700;
  font-size: 10.5pt;
  line-height: 1.25;
  display: block;
}

.tree-card .card-dept {
  font-size: 8pt;
  opacity: 0.88;
  display: block;
  margin-top: 3px;
  font-weight: 500;
}

/* Variantes de cores fiéis ao modelo do usuário */
.card-blue {
  background: linear-gradient(135deg, #1c5276, #154360);
  color: #ffffff;
  border: 1px solid #2980b9;
}

.card-red {
  background: linear-gradient(135deg, #900c3f, #780a34);
  color: #ffffff;
  border: 1px solid #c0392b;
}

.card-orange {
  background: linear-gradient(135deg, #e67e22, #d35400);
  color: #ffffff;
  border: 1px solid #f39c12;
}

.card-green {
  background: linear-gradient(135deg, #27ae60, #1e8449);
  color: #ffffff;
  border: 1px solid #2ecc71;
}

.card-olive {
  background: linear-gradient(135deg, #689f38, #558b2f);
  color: #ffffff;
  border: 1px solid #7cb342;
}

/* Conectores Ortogonais (Linhas de Estrutura) */
.tree-line-v {
  width: 2px;
  height: 24px;
  background-color: var(--text-secondary);
  opacity: 0.6;
}

.tree-departments-container {
  display: flex;
  justify-content: center;
  position: relative;
  width: 100%;
}

.tree-departments-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  position: relative;
  padding-top: 20px;
}

.tree-departments-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 40px;
  right: 40px;
  height: 2px;
  background-color: var(--text-secondary);
  opacity: 0.6;
}

.tree-dept-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 0 0 auto;
}

.tree-dept-col::before {
  content: '';
  position: absolute;
  top: -20px;
  height: 20px;
  width: 2px;
  background-color: var(--text-secondary);
  opacity: 0.6;
}

.tree-sub-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  position: relative;
  width: 100%;
}

.tree-sub-list::before {
  content: '';
  position: absolute;
  top: -16px;
  height: 16px;
  width: 2px;
  background-color: var(--text-secondary);
  opacity: 0.6;
}

/* Container de Pares na Horizontal */
.tree-sub-list-horizontal {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  padding-top: 20px;
  width: 100%;
}

.tree-sub-list-horizontal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 40px;
  right: 40px;
  height: 2px;
  background-color: var(--text-secondary);
  opacity: 0.6;
}

.tree-sub-list-horizontal.single-child::before {
  display: none !important;
}

[data-theme="light"] .tree-line-v,
[data-theme="light"] .tree-departments-row::before,
[data-theme="light"] .tree-dept-col::before,
[data-theme="light"] .tree-sub-list::before,
[data-theme="light"] .tree-sub-list-horizontal::before {
  background-color: #2c3e50;
  opacity: 0.8;
}

/* Controles de Zoom do Modal do Organograma */
.org-zoom-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
}

.org-zoom-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 11pt;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.org-zoom-btn:hover {
  background-color: var(--bg-secondary);
  color: var(--color-highlight);
}

/* Sub-caixas para grupos detalhados de organograma */
.tree-sub-box-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin: 4px 0;
}

.tree-sub-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #004f00;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 8.5pt;
  color: #334155;
  text-align: left;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  line-height: 1.4;
}

.tree-sub-box strong {
  color: #0f172a;
  display: block;
  font-weight: 700;
  margin-bottom: 2px;
}

.tree-sub-box span {
  display: block;
  color: #475569;
}

/* Drag to Scroll (Arraste do Organograma) */
#organograma-zoom-viewport {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

#organograma-zoom-viewport.is-dragging {
  cursor: grabbing !important;
}

#organograma-zoom-viewport.is-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

/* Botão de Agrupar/Expandir Liderados nos Cards do Organograma */
.tree-card {
  position: relative;
}

.tree-card.has-subordinates {
  cursor: pointer;
  padding-right: 32px !important;
}

.tree-card.has-subordinates:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.tree-toggle-badge {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  padding: 2px 5px;
  font-size: 7.5pt;
  font-weight: 700;
  color: #ffffff;
  transition: all 0.2s ease;
  user-select: none;
}

.tree-card:hover .tree-toggle-badge {
  background: rgba(0, 0, 0, 0.45);
  border-color: #ffffff;
}

.tree-card.is-collapsed-card {
  border-style: dashed !important;
  opacity: 0.88;
}

.tree-card.is-collapsed-card .tree-toggle-badge {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #000000 !important;
}

/* Ocultar a lista de liderados quando agrupada */
.tree-sub-list.is-collapsed,
.tree-sub-list-horizontal.is-collapsed,
.tree-departments-row.is-collapsed,
.tree-line-v.is-collapsed {
  display: none !important;
}



