:root {
  --heat-0: #ebedf0;
  --heat-1: #9be9a8;
  --heat-2: #40c463;
  --heat-3: #30a14e;
  --heat-4: #216e39;
  --heat-border: rgba(11, 11, 11, 0.10);
  --heat-muted: #898781;

  /* Superfícies e texto do dashboard (camadas acima do bg-gray-50 do body) */
  --surf-1: #ffffff;
  --surf-2: #f6f6f5;
  --surf-border: rgba(11, 11, 11, 0.09);
  --surf-border-strong: rgba(11, 11, 11, 0.16);
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --shadow-card: 0 1px 2px rgba(11, 11, 11, 0.04);
  --shadow-hover: 0 8px 24px rgba(11, 11, 11, 0.08);
}

:root.dark {
  --heat-0: #21262d;
  --heat-1: #0e4429;
  --heat-2: #006d32;
  --heat-3: #26a641;
  --heat-4: #39d353;
  --heat-border: rgba(255, 255, 255, 0.10);
  --heat-muted: #8b949e;

  --surf-1: #161b22;
  --surf-2: #10141a;
  --surf-border: rgba(255, 255, 255, 0.08);
  --surf-border-strong: rgba(255, 255, 255, 0.14);
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #8b949e;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ==================== Fundamentos do dashboard ==================== */

.dash-secao {
  margin-bottom: 2.5rem;
}

.dash-secao-titulo {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.dash-card {
  background: var(--surf-1);
  border: 1px solid var(--surf-border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.dash-card-hover:hover {
  border-color: var(--surf-border-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

/* ==================== KPI row ==================== */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.kpi-tile {
  padding: 0.9rem 1rem;
}

.kpi-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 650;
  color: var(--text-primary);
  font-variant-numeric: proportional-nums;
  line-height: 1.2;
  margin-top: 0.15rem;
}

.kpi-value[data-contador] { min-width: 2ch; display: inline-block; }

/* ==================== Heatmap em destaque ==================== */

.heatmap-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.25rem 1.5rem;
}

.heatmap-hero-stats {
  display: grid;
  gap: 0.9rem;
  min-width: 150px;
  border-left: 1px solid var(--surf-border);
  padding-left: 1.5rem;
}

.heatmap-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.heatmap-stat-value {
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--text-primary);
}

/* ==================== Destaques da semana ==================== */

.destaques-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.destaque-tile {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.destaque-icone { font-size: 1.1rem; }

.destaque-clicavel { cursor: pointer; }

.destaque-valor {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.3;
}

.destaque-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ==================== Sistemas (cards-filtro) ==================== */

.sistemas-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sistema-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid var(--surf-border);
  background: var(--surf-1);
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.sistema-chip:hover {
  border-color: var(--surf-border-strong);
}

.sistema-chip.ativo {
  background: #C2500F;
  border-color: #C2500F;
  color: #ffffff;
}

.sistema-chip-contagem {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

/* ==================== Timeline compacta ==================== */

.timeline-grupo-titulo {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1.25rem 0 0.5rem;
}

.timeline-grupo-titulo:first-child { margin-top: 0; }

.tl-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease;
}

.tl-item:hover { background: var(--surf-2); }

.tl-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #C2500F;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.tl-corpo { flex: 1; min-width: 0; }

.tl-linha1 {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tl-titulo {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tl-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.tl-sistema {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surf-2);
  border-radius: 5px;
  padding: 0.05rem 0.4rem;
}

.tl-descricao {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 200ms ease, opacity 150ms ease;
}

.tl-item.expandido .tl-descricao {
  max-height: 12rem;
  opacity: 1;
}

.tl-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 150ms ease;
  margin-top: 0.35rem;
}

.tl-item.expandido .tl-chevron { transform: rotate(90deg); }

/* ==================== Kanban ==================== */

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 0.9rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.kanban-coluna {
  background: var(--surf-2);
  border: 1px solid var(--surf-border);
  border-radius: 12px;
  padding: 0.75rem;
  min-height: 120px;
  transition: background 150ms ease, border-color 150ms ease;
}

.kanban-coluna.drag-over {
  background: rgba(194, 80, 15, 0.08);
  border-color: #C2500F;
}

.kanban-coluna-titulo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  padding: 0 0.15rem;
}

.kanban-coluna-contagem {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--surf-1);
  border-radius: 9999px;
  padding: 0.05rem 0.5rem;
}

.kanban-lista {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 420px;
  overflow-y: auto;
}

.kanban-card {
  background: var(--surf-1);
  border: 1px solid var(--surf-border);
  border-radius: 9px;
  padding: 0.6rem 0.7rem;
  cursor: grab;
  transition: border-color 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.kanban-card:hover {
  border-color: var(--surf-border-strong);
  box-shadow: var(--shadow-card);
}

.kanban-card.arrastando { opacity: 0.4; }

.kanban-card-titulo {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.kanban-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--surf-2);
  border-radius: 5px;
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
}

.kanban-vazio {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem 0;
}

/* ==================== Relatório executivo (markdown renderizado) ==================== */

.relatorio-corpo h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.6rem;
}

.relatorio-corpo > p {
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0 0 1.1rem;
}

.relatorio-corpo hr {
  border: none;
  border-top: 1px solid var(--surf-border);
  margin: 1.1rem 0;
}

/* Lista de destaques (nível 1) — cada item vira um card com borda de marca */
.relatorio-corpo > ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.relatorio-corpo > ul > li {
  background: var(--surf-1);
  border: 1px solid var(--surf-border);
  border-left: 3px solid #C2500F;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-card);
}

.relatorio-corpo > ul > li > strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* Sub-lista (Impacto / Detalhes) — vira par rótulo + texto, no estilo dos KPI tiles */
.relatorio-corpo ul ul {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.relatorio-corpo ul ul li {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.relatorio-corpo ul ul li strong {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

/* ==================== Drawer ==================== */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 40;
}

.drawer-overlay.aberto {
  opacity: 1;
  pointer-events: auto;
}

.drawer-painel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  background: var(--surf-1);
  border-left: 1px solid var(--surf-border);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 220ms ease;
  z-index: 41;
  padding: 1.5rem;
  overflow-y: auto;
}

.drawer-painel.aberto { transform: translateX(0); }

/* ==================== Skeleton loading ==================== */

.skeleton {
  background: linear-gradient(90deg, var(--surf-2) 25%, var(--surf-border) 50%, var(--surf-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==================== Responsivo ==================== */

@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .destaques-row { grid-template-columns: repeat(2, 1fr); }
  .heatmap-hero { grid-template-columns: 1fr; }
  .heatmap-hero-stats {
    border-left: none;
    border-top: 1px solid var(--surf-border);
    padding-left: 0;
    padding-top: 1rem;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-flow: column;
  }
  .kanban-board { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}

@media (max-width: 640px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .destaques-row { grid-template-columns: 1fr; }
  .heatmap-hero-stats { grid-template-columns: repeat(2, 1fr); }
  .kanban-board { grid-template-columns: minmax(220px, 1fr); }
}

/* Heatmap estilo GitHub */

.heatmap-topo {
  display: flex;
  gap: 0.4rem;
}

.heatmap-topo { align-items: stretch; }

.heatmap-coluna-grade {
  flex: 1;
  min-width: 0;
}

.heatmap-dias {
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 3px;
  padding-top: 14px;
  font-size: 0.65rem;
  color: var(--heat-muted);
}

.heatmap-meses {
  position: relative;
  display: grid;
  grid-template-columns: repeat(53, minmax(0, 1fr));
  gap: 3px;
  height: 14px;
  font-size: 0.65rem;
  color: var(--heat-muted);
}

.heatmap-mes-label {
  grid-row: 1;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(53, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
}

.heatmap-celula {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  background-color: var(--heat-0);
  border: 1px solid var(--heat-border);
}

.heatmap-celula[data-nivel="1"] { background-color: var(--heat-1); }
.heatmap-celula[data-nivel="2"] { background-color: var(--heat-2); }
.heatmap-celula[data-nivel="3"] { background-color: var(--heat-3); }
.heatmap-celula[data-nivel="4"] { background-color: var(--heat-4); }
.heatmap-celula[data-nivel="futuro"] { background-color: transparent; border-color: transparent; }

.heatmap-legenda {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--heat-muted);
}

.heatmap-legenda-escala {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.heatmap-legenda-escala .heatmap-celula {
  width: 10px;
  height: 10px;
}

/* Badges de impacto comercial na timeline */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-conversao { background: rgba(42, 120, 214, 0.12); color: #1c5cab; }
.badge-leads { background: rgba(27, 175, 122, 0.12); color: #0c7350; }
.badge-forecast { background: rgba(237, 161, 0, 0.15); color: #8a5a00; }
.badge-refatoracao { background: rgba(227, 73, 72, 0.12); color: #c93433; }

:root.dark .badge-conversao { background: rgba(57, 135, 229, 0.18); color: #3987e5; }
:root.dark .badge-leads { background: rgba(25, 158, 112, 0.20); color: #199e70; }
:root.dark .badge-forecast { background: rgba(201, 133, 0, 0.22); color: #eda100; }
:root.dark .badge-refatoracao { background: rgba(230, 103, 103, 0.18); color: #e66767; }

/* Tipo do item na timeline — distingue manutenção (bug/infra/curadoria) de negócio novo (criação) */

.tl-tipo {
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 5px;
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
}

.tl-tipo-criacao { background: rgba(27, 175, 122, 0.12); color: #0c7350; }
.tl-tipo-bug { background: rgba(227, 73, 72, 0.12); color: #c93433; }
.tl-tipo-melhoria_infra { background: rgba(42, 120, 214, 0.12); color: #1c5cab; }
.tl-tipo-curadoria { background: rgba(139, 92, 246, 0.14); color: #6d28d9; }
.tl-tipo-log { background: var(--surf-2); color: var(--text-muted); }

:root.dark .tl-tipo-criacao { background: rgba(25, 158, 112, 0.20); color: #199e70; }
:root.dark .tl-tipo-bug { background: rgba(230, 103, 103, 0.18); color: #e66767; }
:root.dark .tl-tipo-melhoria_infra { background: rgba(57, 135, 229, 0.18); color: #3987e5; }
:root.dark .tl-tipo-curadoria { background: rgba(167, 139, 250, 0.20); color: #a78bfa; }

