* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif; background: #f8f9fa; color: #333; }

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; padding: 25px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky; top: 0; z-index: 100;
}
.header-content { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.header-left h1 { font-size: 28px; margin-bottom: 5px; }
.header-left p { opacity: 0.9; font-size: 14px; }
.header-brand { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.header-right { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-header {
    padding: 10px 16px; background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3);
    color: white; border-radius: 6px; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 500;
}
.btn-header:hover { background: rgba(255,255,255,0.3); }

.container { max-width: 1200px; margin: 0 auto; padding: 30px 20px; }

.filters {
    background: white; padding: 25px; border-radius: 12px; margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px;
}
.filter-group { display: flex; flex-direction: column; }
.filter-group label { font-size: 13px; font-weight: 600; color: #667eea; margin-bottom: 6px; text-transform: uppercase; }
.filter-group select, .filter-group input {
    padding: 10px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 14px;
}
.btn-filter, .btn-export, .btn-pdf {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border: none; padding: 10px 20px; border-radius: 6px;
    cursor: pointer; font-weight: 600; align-self: flex-end;
}
.btn-export { background: white; color: #667eea; border: 2px solid #667eea; }
.btn-export:hover { background: #667eea; color: white; }
.btn-pdf { background: #1e293b; }
.actions-bar { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: white; padding: 25px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border-left: 4px solid #667eea; }
.stat-card.success { border-left-color: #22c55e; }
.stat-card.warning { border-left-color: #f59e0b; }
.stat-card.info { border-left-color: #3b82f6; }
.stat-label { font-size: 13px; color: #6b7280; text-transform: uppercase; font-weight: 600; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 700; color: #1f2937; }

.section-title { font-size: 22px; font-weight: 700; color: #1f2937; margin: 2rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 3px solid #667eea; }
.bloco-section { margin-bottom: 2.5rem; }
.bloco-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; padding: 14px 20px; border-radius: 10px 10px 0 0; font-weight: 700; font-size: 16px;
}

.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 25px; margin-bottom: 30px; }
.chart-card, .pergunta-card {
    background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); overflow: hidden;
}
.chart-title { font-size: 15px; font-weight: 700; color: #1f2937; padding: 20px 20px 0; }
.chart-container { position: relative; height: 280px; padding: 10px 20px 20px; }

.pergunta-card { margin-bottom: 1.5rem; page-break-inside: avoid; }
.pergunta-header { padding: 18px 20px; border-bottom: 1px solid #e5e7eb; }
.pergunta-numero { font-size: 12px; color: #667eea; font-weight: 700; text-transform: uppercase; margin-bottom: 4px; }
.pergunta-texto { font-size: 15px; font-weight: 600; color: #1f2937; line-height: 1.45; }
.pergunta-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 20px; }
.pergunta-chart { height: 260px; position: relative; }
.pergunta-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pergunta-table th { background: #f9fafb; padding: 8px 10px; text-align: left; font-size: 11px; color: #6b7280; text-transform: uppercase; }
.pergunta-table td { padding: 10px; border-bottom: 1px solid #e5e7eb; }
.pergunta-table .pct { font-weight: 700; color: #667eea; text-align: right; white-space: nowrap; }
.table-scroll .pergunta-table { min-width: 280px; }
.pergunta-base { font-size: 12px; color: #6b7280; margin-top: 8px; }

.data-table { background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); overflow: hidden; margin-top: 2rem; }
.table-title { padding: 20px 25px; border-bottom: 1px solid #e5e7eb; font-size: 16px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
th { background: #f9fafb; padding: 12px 25px; text-align: left; font-size: 12px; color: #6b7280; text-transform: uppercase; }
td { padding: 15px 25px; border-bottom: 1px solid #e5e7eb; font-size: 14px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }

.confidencial-banner {
    display: none; text-align: center; padding: 12px; background: #fef2f2;
    color: #991b1b; font-weight: 700; font-size: 13px; letter-spacing: 1px;
    border: 2px solid #fecaca; margin-bottom: 20px;
}

.relatorio-capa { display: none; }
.footer { background: #f3f4f6; padding: 25px; text-align: center; color: #6b7280; font-size: 13px; margin-top: 50px; }

#pdf-loading {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.7);
    z-index: 10000; align-items: center; justify-content: center; color: white; font-size: 18px;
}

@media (max-width: 900px) {
    .pergunta-body { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    header { padding: 16px 14px; }
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .header-left h1 { font-size: 1.35rem; line-height: 1.25; }
    .header-left p { font-size: 0.8rem; }
    .header-right { width: 100%; }
    .header-right .btn-header {
        flex: 1;
        text-align: center;
        justify-content: center;
        padding: 12px 10px;
    }

    .container { padding: 16px 12px; }

    .filters {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 12px;
    }
    .btn-filter {
        width: 100%;
        align-self: stretch;
        padding: 14px;
        font-size: 15px;
    }

    .actions-bar {
        flex-direction: column;
        gap: 10px;
    }
    .actions-bar .btn-pdf,
    .actions-bar .btn-export {
        width: 100%;
        padding: 14px;
        font-size: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.5rem; }
    .stat-label { font-size: 0.7rem; }

    .section-title { font-size: 1.125rem; margin: 1.5rem 0 0.75rem; }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .chart-container { height: 240px; padding: 8px 12px 16px; }
    .chart-title { padding: 16px 16px 0; font-size: 0.9rem; }
    .pergunta-chart { height: 220px; }
    .pergunta-body { padding: 12px; gap: 12px; }
    .pergunta-header { padding: 14px 16px; }
    .pergunta-texto { font-size: 0.9rem; }

    .data-table .table-title { padding: 14px 16px; font-size: 0.9rem; }
    th { padding: 10px 12px; font-size: 0.65rem; }
    td { padding: 10px 12px; font-size: 0.8rem; }

    .relatorio-capa { padding: 1.25rem !important; }
    #capa-titulo { font-size: 1.2rem !important; }

    .footer { padding: 16px; font-size: 0.75rem; margin-top: 24px; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.75rem; }
}

@media print {
    header, .filters, .no-print, .footer, #login-overlay { display: none !important; }
    body { background: white; }
    .container { max-width: 100%; padding: 0; }
    .confidencial-banner, .relatorio-capa { display: block !important; }
    .pergunta-card, .chart-card, .stat-card { box-shadow: none; border: 1px solid #e5e7eb; page-break-inside: avoid; }
    .bloco-section { page-break-before: auto; }
}
