* { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; margin: 0; color: #1f2937; background: #f8fafc; }
.container { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.app-header { background: #f1f5f9; color: #0f172a; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.brand-logo { height: 36px; width: auto; object-fit: contain; border-radius: 4px; background: transparent; }
.nav a { color: #0f172a; margin-left: 14px; text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.btn-primary { background: #38bdf8; padding: 8px 12px; border-radius: 6px; }
.btn-outline { border: 1px solid #38bdf8; color: #38bdf8; padding: 6px 10px; border-radius: 6px; }
.user-tag { margin-left: 10px; opacity: .85; }

main.container { padding: 24px 0 40px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.label { font-weight: 600; margin-bottom: 6px; display: block; }
.input, select { width: 100%; padding: 10px; border: 1px solid #e5e7eb; border-radius: 8px; }
.button { background: #0ea5e9; color: #fff; border: none; padding: 10px 14px; border-radius: 8px; cursor: pointer; }
.button:disabled { opacity: .6; cursor: not-allowed; }
.button.secondary { background: #64748b; }
/* compact and danger variants */
.button.small { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.button.danger { background: #ef4444; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }

.notice { background: #e0f2fe; border: 1px solid #bae6fd; color: #0c4a6e; padding: 8px 12px; border-radius: 8px; display: block; width: fit-content; margin: 8px auto; text-align: center; }
.error { background: #fee2e2; border: 1px solid #fecaca; color: #7f1d1d; padding: 8px 12px; border-radius: 8px; }
.success { background: #dcfce7; border: 1px solid #bbf7d0; color: #14532d; padding: 8px 12px; border-radius: 8px; }

.dropdown { position: relative; display: inline-block; }
.dropbtn { background-color: #e2e8f0; color: #0f172a; padding: 8px 12px; font-size: 14px; border: none; border-radius: 6px; margin-left: 10px; }
.dropdown-content { display: none; position: absolute; background-color: #0f172a; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; border-radius: 8px; overflow: hidden; }
.dropdown-content a { color: #fff; padding: 10px 12px; text-decoration: none; display: block; }
.dropdown-content a:hover { background-color: #1f2937; }
.dropdown:hover .dropdown-content { display: block; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border: 1px solid #e5e7eb; padding: 8px; text-align: left; }
.table th { background: #f1f5f9; }

/* descrição menor para textos de gráficos */
.chart-desc { font-size: 12px; margin-top: 8px; }
/* Comentário final visível apenas no relatório impresso */
.final-comment { display: none; font-size: 13px; color: #334155; margin-top: 4px; }
/* Exibir comentário quando acionado no mobile/teclado */
.final-comment.show { display: block; }

/* Quebra e paginação por sessão no survey */
.survey-section { display: none; }
.survey-section.active { display: block; }
.section-nav { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; }

/* Banner de Nota Final na Sessão Final */
.final-grade-banner {
  text-align: center;
  font-size: 36px;
  font-weight: 700;
  padding: 16px;
  color: #1e40af; /* azul escuro para destaque */
  background: #eff6ff; /* fundo azul bem claro */
  border-radius: 8px;
  margin: 12px 0 16px;
}
.final-grade-banner .finalScoreInline { font-size: 48px; }

/* Ocultar metadados do relatório na tela normal */
.report-meta { display: none; }

@media print {
  /* Página A4 com margens para relatório */
  @page { size: A4; margin: 12mm; }
  /* Fundo branco e remover cabeçalho/nav/barras */
  body { background: #fff; }
  .app-header, .dashboard-toolbar { display: none !important; }
  /* Container ocupa largura total no relatório */
  .container { max-width: 100%; padding: 0; }
  /* Título do relatório mais destacado no PDF */
  .dashboard-title { font-size: 24px; margin: 0 0 8px; }
  .report-meta { text-align: center; color: #64748b; font-size: 12px; margin-bottom: 10px; display: block; }
  /* Aparência de relatório: sem sombras, espaçamento consistente */
  .card { box-shadow: none; border-color: #e5e7eb; page-break-inside: avoid; break-inside: avoid; }
  .kpi { page-break-inside: avoid; break-inside: avoid; }
  .table { page-break-inside: auto; }
  /* Mostrar os comentários e ocultar dicas de mouse no PDF */
  .final-comment { display: block; }
  .chart-desc.notice, .tooltip-icon { display: none !important; }
  /* Garantir que canvases/gráficos imprimam bem */
  canvas { max-width: 100% !important; height: auto !important; }
}

/* Cockpit KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.kpi { background: #ffffff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.kpi-title { font-size: 13px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.02em; }
.kpi-value { font-size: 28px; font-weight: 700; color: #111827; margin-top: 6px; }
.kpi-sub { font-size: 12px; color: #6b7280; margin-top: 4px; }
.kpi-good { border-color: #22c55e; background: #f0fdf4; }
.kpi-medium { border-color: #f59e0b; background: #fffbeb; }
.kpi-bad { border-color: #ef4444; background: #fef2f2; }

@media print {
  .kpi { break-inside: avoid; }
}

/* Tooltip icon beside unit names */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 9999px;
  border: 1px solid #94a3b8;
  color: #334155;
  font-size: 12px;
  background: #f8fafc;
  cursor: help;
}
.tooltip-icon:hover { background: #eef2ff; border-color: #6366f1; color: #1e40af; }

/* ===== Ajustes de tipografia globais ===== */
html { font-size: 15px; }
body { line-height: 1.6; }
.card p, .card li { font-size: 15px; }
.card h3 { font-size: 16px; margin: 0 0 8px; text-align: center; }
.card h4 { font-size: 15px; margin: 0 0 8px; text-align: center; }

/* Unificar fonte mesmo em elementos semânticos */
code, kbd, samp, pre { font-family: inherit; font-size: 0.95em; background: #f1f5f9; padding: 2px 4px; border-radius: 4px; }
strong { font-weight: 600; }
em { font-style: italic; }

/* Espaçamento consistente no Sobre */
.card ul { margin: 8px 0 0; padding-left: 18px; }
.card li { margin: 6px 0; }

/* Barra superior (cockpit) para seleção de questionário */
.dashboard-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; position: static; top: auto; background: #f8fafc; z-index: 1; padding: 10px 0; box-shadow: 0 1px 0 rgba(0,0,0,0.06); }
.dashboard-toolbar .label { margin: 0; font-weight: 600; }
.dashboard-toolbar select { width: auto; min-width: 260px; }
.dashboard-toolbar .current-q { font-size: 13px; color: #334155; background: #e2e8f0; padding: 6px 10px; border-radius: 9999px; }
/* Título do questionário acima dos indicadores */
.dashboard-title { text-align: center; font-size: 22px; font-weight: 700; margin: 6px 0 12px; }
/* Cards compactos para cockpit */
.card.compact { padding: 14px; margin-bottom: 12px; }
/* Grade mais compacta para gráficos do dashboard */
.dashboard-grid { gap: 10px; }

@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; }
  .nav { margin-top: 8px; }
  .col-4, .col-6 { grid-column: span 12; }
  .card canvas { max-width: 100%; height: auto; }
  .dashboard-toolbar { flex-direction: column; align-items: stretch; }
  .dashboard-toolbar select { width: 100%; min-width: 0; }
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 480px) {
  .section-nav { flex-wrap: wrap; gap: 8px; }
  form .button, .section-nav .button { width: 100%; }
}