/* ==========================================================================
   AG5 AGÊNCIA — FLUXOGRAMA INTERATIVO · DESIGN SYSTEM
   Branding: Preto/Branco minimalista (proposta Dogdal) + azul AG5 #39B7FF
   apenas como detalhe pontual. Vermelho discreto para caminhos de "NÃO".
   ========================================================================== */

:root {
  /* Base (paleta Dogdal) */
  --bg: #070707;
  --bg-2: #0d0d0e;
  --panel: #121214;
  --panel-2: #17171a;

  /* Linhas e bordas */
  --line: #232327;
  --line-2: #2e2e34;

  /* Tipografia / tinta */
  --ink: #f4f4f5;
  --ink-2: #a8a8ad;
  --ink-3: #6d6d74;

  /* Accent principal = branco; azul AG5 só em detalhes pontuais */
  --accent: #ffffff;
  --blue: #39B7FF;
  --blue-dim: rgba(57, 183, 255, 0.14);

  /* Caminhos semânticos de negação (discreto) */
  --danger: #EF4444;
  --danger-dim: rgba(239, 68, 68, 0.55);
  --danger-border: rgba(239, 68, 68, 0.4);

  /* Paleta escura por tipo de etapa (sem arco-íris: tons profundos) */
  --ok-bg: #0d2117;
  --ok-line: #2f6b48;
  --ok-ink: #84d3a6;
  --end-bg: #0d1b2b;
  --end-line: #2c5c86;
  --end-ink: #7fb8e6;
  --dec-bg: #0c2123;
  --dec-line: #2e777d;
  --dec-ink: #79c8cf;
  --data-bg: #201a0e;
  --data-bg-2: #191408;
  --data-line: #6b592f;
  --data-ink: #d3b26b;
  --note-bg: #231012;

  /* Sombras suaves escuras */
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 20px 50px rgba(0, 0, 0, 0.6);
  --glow-active: 0 0 24px rgba(255, 255, 255, 0.14);

  /* Fontes */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius-card: 16px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* Container Principal */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at 50% -20%, #101013 0%, var(--bg) 70%);
}

/* ==========================================================================
   HEADER PRINCIPAL — BRANDING AG5 PRETO/BRANCO
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.75rem;
  background: rgba(7, 7, 7, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
  gap: 1.5rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  min-width: 0;
}

.logo-img {
  height: 44px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.header-title h1 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.header-title p {
  font-size: 0.74rem;
  color: var(--ink-3);
  white-space: nowrap;
}

/* Tabs de Fases */
.phase-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--panel);
  padding: 0.3rem;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.phase-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.8rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.22s ease;
}

.phase-tab .tab-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  padding: 0.14rem 0.38rem;
  background: var(--panel-2);
  border-radius: 5px;
  color: var(--ink-3);
}

.phase-tab:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.phase-tab.active {
  background: var(--accent);
  color: #070707;
  box-shadow: 0 2px 12px rgba(255, 255, 255, 0.12);
}

.phase-tab.active .tab-badge {
  background: #070707;
  color: var(--accent);
  font-weight: 700;
}

/* Modos de Visualização & Controles */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.view-mode-toggle {
  display: flex;
  background: var(--panel);
  padding: 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn svg {
  width: 15px;
  height: 15px;
}

.view-btn.active {
  background: var(--accent);
  color: #070707;
}

.icon-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--panel-2);
  border-color: var(--line-2);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   WORKSPACE PRINCIPAL & PALCO DO FLUXOGRAMA
   ========================================================================== */
.main-workspace {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
}

.flowchart-container {
  flex: 1;
  position: relative;
  overflow: auto;
  background:
    radial-gradient(circle at 20% 30%, rgba(57, 183, 255, 0.025) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.02) 0%, transparent 40%),
    var(--bg);
  padding: 3rem;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  cursor: grab;
  touch-action: pan-x pan-y;
}

.flowchart-container.panning {
  cursor: grabbing;
  user-select: none;
}

.flowchart-container.panning .flow-node {
  pointer-events: none;
}

/* Scrollbars discretas */
.flowchart-container::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar,
.linear-track-container::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.flowchart-container::-webkit-scrollbar-thumb,
.sidebar-content::-webkit-scrollbar-thumb,
.linear-track-container::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 6px;
  border: 2px solid var(--bg);
}
.flowchart-container::-webkit-scrollbar-track,
.sidebar-content::-webkit-scrollbar-track,
.linear-track-container::-webkit-scrollbar-track {
  background: transparent;
}

/* Camada SVG dos Conectores */
.connections-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.connection-line {
  stroke: var(--line-2);
  stroke-width: 1.8px;
  fill: none;
  transition: stroke 0.4s ease, stroke-width 0.4s ease;
  stroke-dasharray: 6 4;
}

.connection-line.danger {
  stroke: var(--danger-dim);
}

.connection-line.jump {
  stroke-dasharray: 3 5;
}

.connection-line.active {
  stroke: var(--accent);
  stroke-width: 3px;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.45));
}

.connection-line.active.danger {
  stroke: var(--danger);
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.45));
}

.connection-line.completed {
  stroke: #3f3f46;
  stroke-width: 1.8px;
  stroke-dasharray: none;
}

/* Labels de arestas (chips posicionados sobre os conectores) */
.edge-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  white-space: nowrap;
  z-index: 3;
  pointer-events: none;
}

.edge-label.danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: rgba(239, 68, 68, 0.08);
}

.edge-label.jump {
  color: var(--ink);
  border-color: var(--line-2);
  background: var(--panel-2);
}

/* Camada de Nós (Nodes Layer com amplo espaçamento sem sobreposição) */
.nodes-layer {
  position: relative;
  z-index: 2;
  min-width: 5620px;
  min-height: 1740px;
}

/* Grupos de Fases em Fundo — cada bloco espelha uma página do PDF */
.phase-group {
  position: absolute;
  border: 1px solid var(--line);
  background: rgba(13, 13, 14, 0.55);
  border-radius: 22px;
  transition: all 0.4s ease;
  overflow: hidden;
}

/* Barra de título do grupo, como o cabeçalho de página do PDF */
.phase-group-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1.4rem;
  background: rgba(7, 7, 7, 0.9);
  border-bottom: 1px solid var(--line);
}

.phase-group-header::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px rgba(57, 183, 255, 0.7);
  flex-shrink: 0;
}

.phase-group-header .pg-fase {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
}

.phase-group-header .pg-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-group-note {
  position: absolute;
  bottom: 0.9rem;
  left: 1.4rem;
  right: 1.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-style: italic;
  color: var(--ink-2);
  opacity: 0.9;
  text-align: right;
}

/* ==========================================================================
   CARDS DE NÓS — FORMATOS FIÉIS AO PDF (oval / retângulo / losango / paral.)
   ========================================================================== */
.flow-node {
  position: absolute;
  width: 240px;
  padding: 0.95rem 1.1rem;
  background: var(--panel);
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s ease,
              box-shadow 0.3s ease,
              opacity 0.3s ease;
  user-select: none;
  box-shadow: var(--shadow-card);
}

/* Nós largos estilo "barra" (fases 2–4, textos longos verbatim) */
.flow-node.node-bar {
  width: 360px;
  padding: 0.85rem 1.4rem;
}

.flow-node.node-bar .node-title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.flow-node.node-bar .node-subtitle {
  font-size: 0.68rem;
}

.flow-node:hover {
  transform: translateY(-4px);
  border-color: #4b4b55;
  background: var(--panel-2);
  z-index: 10;
}

/* Formato 1: Início / Fim (oval, como no PDF — verde início, azul término) */
.flow-node.type-start,
.flow-node.type-end {
  width: 280px;
  border-radius: 999px;
  text-align: center;
  background: var(--ok-bg);
  border: 1.5px solid var(--ok-line);
  padding: 1.15rem 1.5rem;
}

.flow-node.type-end {
  background: var(--end-bg);
  border-color: var(--end-line);
}

.flow-node.type-start .node-title,
.flow-node.type-end .node-title {
  color: var(--ok-ink);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.flow-node.type-end .node-title {
  color: var(--end-ink);
}

.flow-node.type-start:hover { background: var(--ok-bg); }
.flow-node.type-end:hover { background: var(--end-bg); }

.flow-node.type-start .node-subtitle,
.flow-node.type-end .node-subtitle {
  margin-top: 0.15rem;
}

/* Formato 2: Decisão (losango real, como no PDF) */
.flow-node.type-decision {
  isolation: isolate;
  width: 380px;
  min-height: 190px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 2.6rem 3.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.5));
}

/* ::before = contorno do losango, ::after = preenchimento (teal escuro) */
.flow-node.type-decision::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: var(--dec-line);
}

.flow-node.type-decision::after {
  content: '';
  position: absolute;
  inset: 2px;
  z-index: -1;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: var(--dec-bg);
}

.flow-node.type-decision:hover {
  background: transparent;
}

.flow-node.type-decision.status-active {
  border: none;
  box-shadow: none;
}

.flow-node.type-decision.status-active::before {
  background: var(--accent);
}

.flow-node.type-decision .node-title {
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.35;
}

.flow-node.type-decision .decision-mini {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--dec-ink);
  margin-bottom: 0.4rem;
}

/* Formato extra: nota de desvio (texto vermelho do PDF na Fase 3) */
.flow-node.type-note {
  width: 250px;
  background: var(--note-bg);
  border: 1.5px dashed var(--danger-border);
}

.flow-node.type-note:hover { background: var(--note-bg); }

.flow-node.type-note .node-title {
  color: var(--danger);
  font-weight: 600;
  font-style: italic;
  font-size: 0.76rem;
  line-height: 1.4;
}

.flow-node.type-note .node-step-tag {
  color: var(--danger);
  border-color: var(--danger-border);
}

/* Formato 3: Registro / Entrada de Dados (paralelogramo — âmbar escuro) */
.flow-node.type-data {
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  border-radius: 0;
  padding-left: 1.6rem;
  padding-right: 1.6rem;
  background: linear-gradient(135deg, var(--data-bg), var(--data-bg-2));
  box-shadow: none;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.4));
}

.flow-node.type-data:hover {
  background: linear-gradient(135deg, var(--data-bg), var(--data-bg-2));
}

.flow-node.type-data .node-step-tag {
  color: var(--data-ink);
  border-color: var(--data-line);
  background: transparent;
}

.flow-node.type-data .node-pill {
  color: var(--data-ink);
  border-color: var(--data-line);
  background: transparent;
  opacity: 0.85;
}

/* Estados de Player do Nó */
.flow-node.status-pending {
  opacity: 0.45;
  filter: grayscale(30%);
}

.flow-node.status-active {
  opacity: 1;
  filter: grayscale(0%);
  border-color: var(--accent);
  box-shadow: var(--glow-active), var(--shadow-card);
  transform: translateY(-5px) scale(1.03);
  z-index: 20;
}

.flow-node.status-active:not(.type-decision)::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, 0.7);
  animation: activeGlowPulse 1.4s infinite cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

@keyframes activeGlowPulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.07); opacity: 0; }
}

.flow-node.status-completed {
  opacity: 0.9;
  border-color: #3f3f46;
}

.flow-node.status-completed .node-badge-check {
  display: inline-flex;
}

/* Conteúdo Interno dos Cards de Nó */
.node-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.node-step-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 0.14rem 0.4rem;
  border-radius: 5px;
}

.flow-node.status-active .node-step-tag {
  background: var(--accent);
  border-color: var(--accent);
  color: #070707;
}

/* Marcador de etapa ativa — dot azul AG5 pontual */
.flow-node.status-active .node-step-tag::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
  margin-left: 5px;
  vertical-align: 1px;
}

.node-badge-check {
  display: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  color: #070707;
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}

.node-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* Botão "i" de informações da etapa (visível no mobile) */
.node-info-btn {
  display: none;
  position: absolute;
  top: -10px;
  right: -8px;
  width: 27px;
  height: 27px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #070707;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  font-style: italic;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
  z-index: 6;
}

/* Paralelogramo corta os cantos (clip-path): "i" fica dentro da forma */
.flow-node.type-data .node-info-btn {
  top: 5px;
  right: 20px;
}

/* Ovais: "i" encostado na borda arredondada */
.flow-node.type-start .node-info-btn,
.flow-node.type-end .node-info-btn {
  top: -6px;
  right: 14px;
}

/* Losango: "i" abaixo do texto, dentro da forma */
.flow-node.type-decision .node-info-btn {
  position: static;
  margin-top: 0.5rem;
}

@media (max-width: 900px) {
  /* Alvo de toque generoso: o zoom reduzido encolhe o botão na tela */
  .node-info-btn {
    display: flex;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    top: -16px;
    right: -14px;
  }

  .flow-node.type-data .node-info-btn {
    top: 2px;
    right: 18px;
  }

  .flow-node.type-start .node-info-btn,
  .flow-node.type-end .node-info-btn {
    top: -12px;
    right: 10px;
  }
}

.node-subtitle {
  font-size: 0.7rem;
  color: var(--ink-3);
  margin-top: 0.22rem;
  line-height: 1.3;
}

.node-tool-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.node-pill {
  font-size: 0.58rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink-3);
}

/* ==========================================================================
   MODO TRILHA LINEAR DIDÁTICA (VISÃO PASSO A PASSO)
   ========================================================================== */
.linear-track-container {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem;
  background: var(--bg);
}

.track-list {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.track-card {
  display: flex;
  gap: 1.15rem;
  padding: 1.15rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.22s ease;
}

.track-card:hover {
  background: var(--panel-2);
  border-color: var(--line-2);
}

.track-card.active {
  border-color: var(--accent);
  background: var(--panel-2);
  box-shadow: var(--glow-active);
}

.track-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  padding: 0.35rem 0.65rem;
  border-radius: 9px;
  height: fit-content;
}

.track-card.active .track-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #070707;
}

.track-body h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.28rem;
  letter-spacing: -0.01em;
}

.track-body p {
  font-size: 0.83rem;
  color: var(--ink-2);
  line-height: 1.45;
}

/* ==========================================================================
   PAINEL LATERAL DE EXPLICAÇÃO INTEGRADO
   ========================================================================== */
.details-sidebar {
  width: 390px;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.45);
}

.sidebar-header {
  position: relative;
  padding: 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 7, 7, 0.5);
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 0.95rem;
  cursor: pointer;
}

.phase-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  background: var(--panel-2);
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  margin-bottom: 0.55rem;
}

.sidebar-header h2 {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.sidebar-content {
  padding: 1.4rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  flex: 1;
}

.info-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.box-icon {
  font-size: 1.15rem;
}

.box-label {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.box-text strong {
  font-size: 0.85rem;
  color: var(--ink);
}

.tools-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.tool-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  border-radius: 6px;
}

.explanation-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.05rem;
}

.exp-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

/* Dot azul AG5 — detalhe pontual */
.bullet-dot {
  width: 7px;
  height: 7px;
  background: var(--blue);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(57, 183, 255, 0.7);
  flex-shrink: 0;
}

.exp-title h3 {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}

.explanation-card p {
  font-size: 0.83rem;
  color: var(--ink-2);
  line-height: 1.55;
}

.checklist-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checklist-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--ink-2);
  line-height: 1.4;
}

.checklist-list .check-box {
  color: var(--ink);
  font-weight: 800;
  font-size: 0.78rem;
}

/* Legenda do PDF */
.sidebar-legend {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  background: rgba(7, 7, 7, 0.7);
}

.legend-title {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  display: block;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.leg-item {
  font-size: 0.66rem;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.shape-oval { width: 11px; height: 11px; border-radius: 50%; background: transparent; border: 1.5px solid var(--ok-ink); }
.shape-rect { width: 11px; height: 9px; border-radius: 2px; background: transparent; border: 1.5px solid var(--ink-2); }
.shape-diamond { width: 8px; height: 8px; transform: rotate(45deg); background: transparent; border: 1.5px solid var(--dec-ink); }
.shape-data { width: 11px; height: 9px; background: transparent; border: 1.5px solid var(--data-ink); transform: skewX(-14deg); }

/* ==========================================================================
   BARRA DE CONTROLE INFERIOR (PLAYER BAR — PRETO/BRANCO AG5)
   ========================================================================== */
.player-bar {
  background: rgba(7, 7, 7, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 0.8rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  z-index: 90;
}

.timeline-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.timeline-bar {
  width: 100%;
  height: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
}

.timeline-fill {
  height: 100%;
  background: linear-gradient(90deg, #6d6d74, #ffffff);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.timeline-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #070707;
  border: 2.5px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
  transition: left 0.3s ease;
}

.timeline-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  gap: 1rem;
}

.counter-badge {
  font-family: var(--font-mono);
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
}

.step-title-display {
  color: var(--ink-3);
  font-weight: 500;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  position: relative;
}

.player-btn {
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--ink);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.player-btn:hover {
  background: var(--panel-2);
  border-color: #4b4b55;
  transform: scale(1.05);
}

.player-btn svg {
  width: 20px;
  height: 20px;
}

/* Botão primário = branco com texto preto */
.player-btn.main-play-btn {
  width: 52px;
  height: 52px;
  background: var(--accent);
  color: #070707;
  border: none;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.18);
}

.player-btn.main-play-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 4px 28px rgba(255, 255, 255, 0.3);
}

.speed-selector {
  position: absolute;
  right: 0;
  display: flex;
  gap: 0.25rem;
  background: var(--panel);
  padding: 0.25rem;
  border-radius: 9px;
  border: 1px solid var(--line);
}

.speed-btn {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
}

.speed-btn.active {
  background: var(--accent);
  color: #070707;
}

/* ==========================================================================
   MODAL DE DECISÃO DIDÁTICO
   ========================================================================== */
.decision-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 7, 7, 0.97);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

/* Cartão em tela cheia: a decisão toma conta da tela inteira */
.decision-card {
  background: radial-gradient(circle at 50% 30%, #101013 0%, var(--bg) 75%);
  border: none;
  border-radius: 0;
  padding: clamp(2rem, 6vw, 5rem);
  max-width: none;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: none;
  animation: popIn 0.35s ease;
}

@keyframes popIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.decision-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem;
  background: var(--panel-2);
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  margin-bottom: 1rem;
}

.decision-card h3 {
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  max-width: 900px;
  line-height: 1.2;
}

.decision-card p {
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: var(--ink-2);
  margin-bottom: 3rem;
  line-height: 1.6;
  max-width: 640px;
}

.decision-actions {
  display: flex;
  gap: 1.25rem;
  width: min(720px, 92%);
}

.btn-decision {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1.25rem 1.5rem;
  border-radius: 16px;
  border: none;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.22s ease;
}

.btn-approve {
  background: var(--accent);
  color: #070707;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.15);
}

.btn-approve:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(255, 255, 255, 0.28);
}

.btn-reject {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.btn-reject:hover {
  background: var(--danger);
  color: #FFFFFF;
  transform: translateY(-2px);
}

/* ==========================================================================
   ZOOM DO VISUALIZADOR
   ========================================================================== */
.zoom-stage {
  position: relative;
  width: max-content;
}

.zoom-controls {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(7, 7, 7, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.zoom-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.zoom-btn:hover {
  background: var(--panel-2);
  color: var(--ink);
}

.zoom-btn.zoom-reset {
  width: auto;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-2);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   MOBILE (≤900px) — fluxo em tela cheia + detalhes deslizando da direita
   ========================================================================== */
@media (max-width: 900px) {
  .app-container {
    height: 100dvh;
  }

  /* Header compacto e empilhado */
  .app-header {
    flex-wrap: wrap;
    padding: 0.55rem 0.85rem;
    gap: 0.55rem;
  }

  .logo-img {
    height: 30px;
  }

  .header-title h1 {
    font-size: 0.78rem;
    white-space: normal;
    line-height: 1.25;
  }

  .header-title p {
    display: none;
  }

  .phase-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .phase-tabs::-webkit-scrollbar {
    display: none;
  }

  .phase-tab {
    flex-shrink: 0;
    padding: 0.38rem 0.65rem;
    font-size: 0.7rem;
  }

  .header-controls {
    margin-left: auto;
  }

  .view-btn span {
    display: none;
  }

  /* Fluxo ocupa a tela; painel de detalhes vira gaveta pela direita */
  .flowchart-container {
    padding: 1.25rem;
  }

  .details-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 360px);
    transform: translateX(105%);
    transition: transform 0.3s cubic-bezier(0.22, 0.7, 0.2, 1);
    box-shadow: -18px 0 44px rgba(0, 0, 0, 0.65);
    border-left: 1px solid var(--line-2);
  }

  .details-sidebar.open {
    transform: none;
  }

  .sidebar-close {
    display: flex;
  }

  .sidebar-legend {
    display: none;
  }

  /* Player bar compacta */
  .player-bar {
    padding: 0.55rem 0.85rem;
    gap: 0.5rem;
  }

  .player-controls {
    gap: 0.75rem;
  }

  .player-btn {
    width: 38px;
    height: 38px;
  }

  .player-btn.main-play-btn {
    width: 46px;
    height: 46px;
  }

  .speed-selector {
    display: none;
  }

  .step-title-display {
    max-width: 55vw;
  }

  .zoom-controls {
    left: 12px;
    bottom: 12px;
  }

  /* Decisão fullscreen: botões empilhados */
  .decision-actions {
    flex-direction: column;
    width: min(480px, 92%);
  }
}
