:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(26, 34, 52, 0.9);
    --bg-sidebar: #0e1424;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(16, 185, 129, 0.3);

    --primary: #10b981;
    --primary-hover: #059669;
    --primary-glow: rgba(16, 185, 129, 0.2);
    --secondary: #06b6d4;
    --accent-purple: #8b5cf6;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    background-image:
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.06) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* Navbar Superior Unificada (Substitui Sidebar fixa antiga) */
.navbar-header {
    background: #0b0f19;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 900;
    backdrop-filter: blur(12px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-brand h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.top-nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.top-nav-links .nav-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.top-nav-links .nav-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.top-nav-links .nav-item.active {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.top-nav-links .nav-item.highlight-nav {
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.3);
    background: rgba(167, 139, 250, 0.08);
}

.top-nav-links .nav-item.highlight-nav.active {
    background: rgba(167, 139, 250, 0.2);
    color: #ffffff;
}

.nav-db-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 5px 12px;
    border-radius: 20px;
}

/* Sidebar legada (oculta) */
.sidebar {
    display: none !important;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 0 8px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 16px var(--primary-glow);
}

.brand h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.badge-research {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-glow);
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: var(--primary);
    background: var(--primary-glow);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.ec2-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator.online {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.status-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
}

.status-desc {
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Main Content em Largura Total */
.main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 1440px !important;
    margin: 0 auto !important;
    padding: 28px 32px !important;
    flex: 1;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1000;
}

.header-titles h1 {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 40%, #a7f3d0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ============================================================
   CONTROLES DE FILTRO DE DATA
   ============================================================ */
.filter-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 1001;
}

.date-picker-group {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1002;
}

.date-picker-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-input-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 1003;
    background: rgba(11, 15, 25, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.date-input-container:hover,
.date-input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.custom-date-input {
    background: transparent !important;
    border: none !important;
    color: var(--text-main) !important;
    padding: 8px 10px !important;
    font-family: var(--font-mono), monospace !important;
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.5px !important;
    width: 110px !important;
    text-align: center !important;
    outline: none !important;
    cursor: text;
}

.custom-date-input::placeholder {
    color: var(--text-dim);
}

.btn-cal-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 10px 8px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
}

.btn-cal-toggle:hover {
    color: var(--primary);
    transform: scale(1.1);
}

/* ============================================================
   CALENDÁRIO POPOVER PERSONALIZADO (PADRÃO DARK DO DASHBOARD)
   ============================================================ */
.calendar-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100000;
    width: 248px;
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 10px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
    padding: 10px !important;
    user-select: none;
    font-family: var(--font-body), -apple-system, sans-serif !important;
    color: #f3f4f6 !important;
    animation: calFadeIn 0.12s ease-out;
}

@keyframes calFadeIn {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header com os dois selects arredondados: [ Mês ⬍ ] [ Ano ⬍ ] */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cal-select {
    appearance: none;
    -webkit-appearance: none;
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 6px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    color: #ffffff !important;
    font-family: inherit !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    height: 28px !important;
    padding: 2px 22px 2px 10px !important;
    cursor: pointer !important;
    outline: none !important;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%2212%22%20viewBox%3D%220%200%208%2012%22%3E%3Cpath%20fill%3D%22%239ca3af%22%20d%3D%22M4%200L1%204h6L4%200zm0%2012l3-4H1l3%204z%22%2F%3E%3C%2Fsvg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 7px center !important;
    background-size: 8px 10px !important;
}

.cal-select:hover {
    border-color: #8b5cf6 !important;
    background-color: #243248 !important;
}

.cal-select option {
    background: #0f172a !important;
    color: #ffffff !important;
}

/* Cabeçalho dos dias da semana: Dom Seg Ter Qua Qui Sex Sáb */
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 6px;
}

.cal-weekday {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #94a3af !important;
    padding: 2px 0 !important;
}

/* Grade de 42 células (6 linhas x 7 colunas) */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-day {
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #f3f4f6 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.12s ease !important;
}

/* Dias de outros meses (anteriores e posteriores) */
.cal-day.other-month {
    color: #475569 !important;
    font-weight: 400 !important;
}

/* Hover e seleção */
.cal-day:hover {
    background: rgba(139, 92, 246, 0.25) !important;
    color: #ffffff !important;
}

.cal-day.selected {
    background: #8b5cf6 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4) !important;
}

.cal-day.today:not(.selected) {
    box-shadow: inset 0 0 0 1px #10b981 !important;
}

        /* Buttons */
        .btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            border-radius: var(--radius-sm);
            font-family: var(--font-body);
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            border: none;
            transition: all 0.2s ease;
            text-decoration: none;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--primary), var(--primary-hover));
            color: #0b0f19;
            box-shadow: 0 4px 12px var(--primary-glow);
        }

        .btn-primary:hover {
            filter: brightness(1.1);
            transform: translateY(-1px);
        }

        .btn-secondary {
            background: rgba(255, 255, 255, 0.05);
            color: var(--text-main);
            border: 1px solid var(--border-color);
        }

        .btn-secondary:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        /* Cards */
        .card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-lg);
            padding: 24px;
            box-shadow: var(--shadow-card);
            backdrop-filter: blur(16px);
        }

        /* KPI Grid */
        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 20px;
            margin-bottom: 32px;
        }

        .kpi-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            padding: 20px;
            display: flex;
            align-items: center;
            gap: 16px;
            transition: transform 0.2s, border-color 0.2s;
            backdrop-filter: blur(12px);
        }

        .kpi-card:hover {
            transform: translateY(-2px);
            border-color: rgba(255, 255, 255, 0.15);
        }

        .kpi-icon {
            width: 48px;
            height: 48px;
            border-radius: var(--radius-md);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .icon-posts {
            background: rgba(16, 185, 129, 0.15);
            color: var(--primary);
        }

        .icon-likes {
            background: rgba(244, 63, 94, 0.15);
            color: var(--accent-rose);
        }

        .icon-comments {
            background: rgba(6, 182, 212, 0.15);
            color: var(--secondary);
        }

        .icon-engagement {
            background: rgba(139, 92, 246, 0.15);
            color: var(--accent-purple);
        }

        .kpi-label {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            font-weight: 600;
        }

        .kpi-value {
            font-family: var(--font-mono);
            font-size: 1.6rem;
            font-weight: 700;
            color: var(--text-main);
            margin: 2px 0;
        }

        .kpi-subtext {
            font-size: 0.75rem;
            color: var(--text-dim);
        }

        /* Content Sections */
        .content-section {
            margin-bottom: 40px;
        }

        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            margin-bottom: 16px;
            gap: 16px;
            flex-wrap: wrap;
        }

        .section-header h2 {
            font-family: var(--font-heading);
            font-size: 1.35rem;
            font-weight: 700;
        }

        .section-desc {
            font-size: 0.85rem;
            color: var(--text-muted);
            margin-top: 4px;
            max-width: 800px;
        }

        /* Toggle Buttons */
        .toggle-buttons {
            display: flex;
            background: rgba(0, 0, 0, 0.4);
            padding: 4px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border-color);
        }

        .toggle-btn {
            background: transparent;
            border: none;
            color: var(--text-muted);
            padding: 6px 12px;
            border-radius: 6px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .toggle-btn.active {
            background: var(--primary);
            color: #0b0f19;
        }

        /* Chart Container */
        .chart-container {
            height: 420px;
            position: relative;
        }

        /* Grids */
        .grid-2-cols {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 24px;
        }

        .chart-card {
            height: 450px;
            display: flex;
            flex-direction: column;
        }

        .chart-box {
            flex: 1;
            position: relative;
            min-height: 0;
        }

        .card-title {
            font-family: var(--font-heading);
            font-size: 1.05rem;
            margin-bottom: 16px;
            color: var(--text-main);
        }

        /* Tables */
        .table-responsive {
            overflow-x: auto;
            max-height: 380px;
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.85rem;
            text-align: left;
        }

        .data-table th {
            position: sticky;
            top: 0;
            background: #111726;
            color: var(--text-muted);
            font-weight: 600;
            padding: 12px 14px;
            border-bottom: 1px solid var(--border-color);
        }

        .data-table td {
            padding: 12px 14px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.04);
            color: var(--text-main);
        }

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

        /* Badges & Pills */
        .theme-pill {
            display: inline-block;
            padding: 3px 8px;
            border-radius: 12px;
            font-size: 0.72rem;
            font-weight: 600;
            background: rgba(255, 255, 255, 0.08);
            color: var(--text-main);
            margin: 2px;
        }

        .select-input {
            background: rgba(0, 0, 0, 0.4);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            padding: 6px 12px;
            border-radius: var(--radius-sm);
            font-size: 0.85rem;
            outline: none;
        }

        .caption-preview {
            max-width: 250px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: var(--text-muted);
            cursor: pointer;
        }

        .caption-preview:hover {
            color: var(--primary);
            text-decoration: underline;
        }

        .btn-link {
            color: var(--secondary);
            text-decoration: none;
            font-weight: 600;
        }

        .btn-link:hover {
            text-decoration: underline;
        }

        /* Modal */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.75);
            backdrop-filter: blur(6px);
            z-index: 100;
            align-items: center;
            justify-content: center;
        }

        .modal.active {
            display: flex;
        }

        .modal-content {
            width: 90%;
            max-width: 580px;
            max-height: 85vh;
            overflow-y: auto;
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 14px;
            margin-bottom: 16px;
        }

        .btn-close {
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-size: 1.5rem;
            cursor: pointer;
        }

        .modal-caption-box {
            background: rgba(0, 0, 0, 0.35);
            padding: 16px;
            border-radius: var(--radius-sm);
            font-size: 0.9rem;
            line-height: 1.6;
            margin: 16px 0;
            white-space: pre-wrap;
        }

        .modal-footer {
            display: flex;
            justify-content: flex-end;
            border-top: 1px solid var(--border-color);
            padding-top: 14px;
        }

        .word-cloud {
            align-content: center;
            align-items: baseline;
            display: flex;
            flex-wrap: wrap;
            gap: 8px 14px;
            height: 100%;
            justify-content: center;
            overflow: auto;
            padding: 12px;
        }

        .word-cloud span {
            color: #a7f3d0;
            font-weight: 600;
        }

        .word-cloud span:nth-child(3n) {
            color: #67e8f9;
        }

        .word-cloud span:nth-child(3n + 1) {
            color: #c4b5fd;
        }

        .chart-footnote,
        .method-note {
            color: var(--text-muted);
            font-size: 0.78rem;
        }

        .method-note {
            background: rgba(6, 182, 212, 0.07);
            border-left: 3px solid var(--secondary);
            border-radius: 4px;
            margin-top: 14px;
            padding: 12px 14px;
        }

        .coding-summary {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 16px;
            margin-top: 20px;
        }

        .coding-summary div {
            display: flex;
            flex-direction: column;
            gap: 3px;
        }

        .coding-summary strong {
            color: var(--primary);
            font-family: var(--font-mono);
            font-size: 1.35rem;
        }

        .coding-summary span {
            color: var(--text-muted);
            font-size: 0.78rem;
        }

        .post-coding {
            border-top: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 18px;
            padding-top: 16px;
        }

        .post-coding h4 {
            margin-bottom: 4px;
        }

        .post-coding label {
            color: var(--text-muted);
            font-size: 0.8rem;
        }

        .post-coding input,
        .post-coding textarea {
            width: 100%;
        }

        .post-coding textarea {
            resize: vertical;
        }

        .post-coding small {
            color: var(--text-dim);
        }

        .analysis-kpis {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 14px;
            margin: 18px 0;
        }

        .analysis-kpis .card {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding: 16px;
        }

        .analysis-kpis span {
            color: var(--text-muted);
            font-size: 0.76rem;
        }

        .analysis-kpis strong {
            color: var(--primary);
            font-family: var(--font-mono);
            font-size: 1.2rem;
        }

        .analysis-charts {
            margin-bottom: 18px;
        }

        .analysis-charts .chart-card {
            min-height: 390px;
        }

        .word-cloud {
            gap: 8px 12px;
        }

        @media (max-width: 700px) {
            .coding-summary {
                grid-template-columns: 1fr;
            }

            .analysis-kpis {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        @media (max-width: 1024px) {
            .sidebar {
                display: none;
            }

            .main-content {
                margin-left: 0;
                padding: 20px;
            }

            .grid-2-cols {
                grid-template-columns: 1fr;
            }
        }

        /* Academic dashboard modules */
        :root {
            --primary: #9b8afb;
            --primary-hover: #8065ea;
            --primary-glow: rgba(139, 92, 246, 0.2);
            --border-glow: rgba(139, 92, 246, 0.3);
        }

        .brand-icon {
            background: linear-gradient(135deg, #7958e8, #3b82f6);
        }

        .nav-item.active {
            color: #c4b5fd;
            background: rgba(139, 92, 246, 0.15);
            border-color: rgba(167, 139, 250, 0.3);
        }

        .btn-primary {
            background: linear-gradient(135deg, #8b5cf6, #6d4ed1);
            color: #fff;
        }

        .eyebrow {
            color: #a78bfa;
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.13em;
            margin-bottom: 5px;
        }

        .header-titles h1 {
            background: linear-gradient(120deg, #fff 30%, #c4b5fd 90%);
            -webkit-background-clip: text;
        }

        .dashboard-module {
            scroll-margin-top: 24px;
        }

        .dashboard-module>.section-header {
            align-items: center;
        }

        .module-controls {
            align-items: center;
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .module-controls label {
            color: var(--text-muted);
            font-size: 0.78rem;
        }

        .theme-multiselect {
            min-width: 235px;
            max-width: 340px;
        }

        .theme-multiselect option {
            padding: 4px;
        }

        .kpi-value-small {
            font-family: var(--font-heading);
            font-size: 1.12rem;
            line-height: 1.25;
        }

        .card-heading {
            align-items: flex-start;
            display: flex;
            justify-content: space-between;
            gap: 14px;
        }

        .card-caption {
            color: var(--text-dim);
            font-size: 0.76rem;
            margin: -10px 0 14px;
        }

        .overview-grid .chart-card {
            height: 370px;
        }

        .compact-grid .chart-card {
            height: 300px;
        }

        .availability {
            border-radius: 999px;
            display: inline-block;
            font-size: 0.68rem;
            padding: 3px 7px;
            white-space: nowrap;
        }

        .availability.unavailable {
            background: rgba(148, 163, 184, 0.12);
            color: #cbd5e1;
        }

        .btn-mark,
        .btn-link-action {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            cursor: pointer;
            font-size: 0.72rem;
            margin: 2px;
            padding: 5px 8px;
        }

        .btn-mark.marked {
            background: rgba(139, 92, 246, 0.18);
            border-color: #8b5cf6;
            color: #c4b5fd;
        }

        .btn-link-action {
            color: #67e8f9;
        }

        .ranking-header {
            align-items: flex-end !important;
            margin-top: 32px;
        }

        .epistemic-alert {
            align-items: flex-start;
            background: rgba(245, 158, 11, 0.09);
            border: 1px solid rgba(245, 158, 11, 0.26);
            border-left: 4px solid #fbbf24;
            border-radius: 10px;
            color: #fde68a;
            display: flex;
            flex-direction: column;
            gap: 4px;
            margin: 14px 0 20px;
            padding: 14px 16px;
        }

        .epistemic-alert span {
            color: #d1d5db;
            font-size: 0.84rem;
            line-height: 1.55;
        }

        .chart-footnote {
            display: block;
            margin-top: 8px;
        }

        .word-cloud {
            gap: 9px 14px;
        }

        .word-cloud span {
            background: rgba(139, 92, 246, 0.1);
            border: 1px solid rgba(167, 139, 250, 0.16);
            border-radius: 999px;
            color: #c4b5fd;
            padding: 3px 8px;
        }

        .word-cloud span:nth-child(3n) {
            color: #67e8f9;
        }

        .word-cloud span:nth-child(3n + 1) {
            color: #f9a8d4;
        }

        @media (max-width: 720px) {
            .filter-controls {
                width: 100%;
            }

            .filter-controls .btn {
                flex: 1;
                justify-content: center;
            }

            .module-controls {
                width: 100%;
            }

            .theme-multiselect {
                width: 100%;
                max-width: none;
            }

            .card-heading {
                flex-direction: column;
            }

            .overview-grid .chart-card,
            .compact-grid .chart-card {
                height: 360px;
            }

            .table-responsive {
                max-height: 540px;
            }
        }

        /* Layout fluido: ocupa a viewport sem criar rolagem horizontal. */
        html,
        body {
            width: 100%;
            max-width: 100%;
            overflow-x: hidden;
        }

        .app-container {
            width: 100%;
            max-width: 100%;
            min-width: 0;
        }

        .sidebar {
            width: 240px;
            padding-right: 14px;
            padding-left: 14px;
        }

        .main-content {
            width: calc(100% - 240px);
            max-width: none;
            min-width: 0;
            margin-left: 240px;
            padding-right: clamp(18px, 2.5vw, 40px);
            padding-left: clamp(18px, 2.5vw, 40px);
        }

        .main-content>*,
        .dashboard-module,
        .card,
        .grid-2-cols,
        .kpi-grid,
        .section-header,
        .top-header,
        .header-titles,
        .module-controls,
        .filter-controls,
        .chart-container,
        .chart-box {
            min-width: 0;
            max-width: 100%;
        }

        .grid-2-cols {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .module-controls select,
        .filter-controls input,
        .filter-controls select {
            max-width: 100%;
        }

        .table-responsive {
            width: 100%;
            min-width: 0;
            overflow-x: hidden;
        }

        .data-table {
            width: 100%;
            min-width: 0;
            table-layout: fixed;
        }

        .data-table th,
        .data-table td {
            overflow-wrap: anywhere;
            word-break: normal;
        }

        /* Com 12 campos, os posts viram cartões compactos antes de apertar a página. */
        @media (max-width: 1320px) {
            #table-top-posts thead {
                display: none;
            }

            #table-top-posts,
            #table-top-posts tbody {
                display: block;
                width: 100%;
            }

            #table-top-posts tbody {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 12px;
            }

            #table-top-posts tbody tr {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                align-content: start;
                min-width: 0;
                overflow: hidden;
                border: 1px solid var(--border-color);
                border-radius: var(--radius-md);
                background: rgba(255, 255, 255, .018);
            }

            #table-top-posts td {
                display: flex;
                flex-direction: column;
                gap: 4px;
                min-width: 0;
                padding: 9px 11px;
                font-size: .78rem;
            }

            #table-top-posts td::before {
                content: attr(data-label);
                color: var(--text-dim);
                font-size: .66rem;
                font-weight: 700;
                letter-spacing: .04em;
                text-transform: uppercase;
            }

            #table-top-posts td:first-child,
            #table-top-posts td:nth-child(11),
            #table-top-posts td:last-child {
                grid-column: 1 / -1;
            }
        }

        /* Layout analítico profundo: 3 colunas e outliers */
        .grid-3-cols {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 16px;
            margin-top: 16px;
        }

        .analytic-grid .chart-box {
            height: 240px;
        }

        #card-outliers {
            margin-top: 20px;
        }

        .badge-info {
            display: inline-block;
            padding: 4px 10px;
            font-size: 0.76rem;
            font-weight: 600;
            color: #38bdf8;
            background: rgba(56, 189, 248, 0.12);
            border: 1px solid rgba(56, 189, 248, 0.3);
            border-radius: 6px;
        }

        .sigma-badge {
            display: inline-flex;
            align-items: center;
            padding: 2px 7px;
            font-size: 0.72rem;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            color: #f43f5e;
            background: rgba(244, 63, 94, 0.12);
            border: 1px solid rgba(244, 63, 94, 0.3);
            border-radius: 4px;
        }

        .caption-preview {
            max-width: 280px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 0.78rem;
            color: #94a3b8;
        }

        /* Cards de sentimento explícitos */
        .sentiment-kpi-grid {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 16px;
        }

        .kpi-card-positive {
            border-left: 3px solid #34d399 !important;
        }

        .kpi-card-neutral {
            border-left: 3px solid #8b93b8 !important;
        }

        .kpi-card-negative {
            border-left: 3px solid #fb7185 !important;
        }

        /* ============================================================ */
        /* MÓDULO 5: CATEGORY CHIPS, DEEP DIVE & TOP 10 POSTS FEED     */
        /* ============================================================ */

        .category-chips-bar {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            margin-bottom: 16px;
        }

        .chip-btn {
            background: rgba(30, 41, 59, 0.7);
            border: 1px solid rgba(255, 255, 255, 0.12);
            color: #cbd5e1;
            padding: 7px 14px;
            border-radius: 20px;
            font-size: 0.82rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
        }

        .chip-btn:hover {
            color: #ffffff;
            border-color: var(--chip-color, #8b5cf6);
            background: rgba(255, 255, 255, 0.08);
            transform: translateY(-1px);
        }

        .chip-btn.active {
            background: var(--chip-color, #8b5cf6) !important;
            border-color: var(--chip-color, #8b5cf6) !important;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
            color: #0b0f19 !important;
            font-weight: 700;
        }

        /* Deep dive card */
        .category-deep-dive-card {
            background: #111827;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 24px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
        }

        .deep-dive-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            flex-wrap: wrap;
            padding-bottom: 16px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            margin-bottom: 18px;
        }

        .deep-dive-title-wrap {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .deep-dive-dot {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background-color: #8b5cf6;
            box-shadow: 0 0 10px currentColor;
            display: inline-block;
        }

        .deep-dive-controls {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .deep-dive-controls label {
            font-size: 0.8rem;
            color: #94a3b8;
            font-weight: 600;
        }

        .deep-dive-kpis {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 16px;
            margin-bottom: 18px;
        }

        .dd-kpi-item {
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(255, 255, 255, 0.06);
            border-radius: 8px;
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .dd-kpi-label {
            font-size: 0.74rem;
            color: #94a3b8;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            font-weight: 600;
        }

        .dd-kpi-value {
            font-size: 1.35rem;
            color: #ffffff;
            font-weight: 800;
            font-family: 'Outfit', sans-serif;
        }

        .dd-kpi-sub {
            font-size: 0.74rem;
            color: #64748b;
        }

        .deep-dive-tags-row {
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding-top: 14px;
            border-top: 1px solid rgba(255, 255, 255, 0.06);
        }

        .dd-tags-group {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .dd-group-label {
            font-size: 0.78rem;
            color: #94a3b8;
            font-weight: 600;
            min-width: 170px;
        }

        .dd-tags-list,
        .dd-authors-list {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .dd-tag-pill {
            background: rgba(56, 189, 248, 0.1);
            color: #38bdf8;
            border: 1px solid rgba(56, 189, 248, 0.25);
            font-size: 0.75rem;
            padding: 3px 8px;
            border-radius: 6px;
            font-weight: 500;
        }

        .dd-author-pill {
            background: rgba(167, 139, 250, 0.12);
            color: #c4b5fd;
            border: 1px solid rgba(167, 139, 250, 0.25);
            font-size: 0.75rem;
            padding: 3px 8px;
            border-radius: 6px;
            font-weight: 600;
            text-decoration: none;
            transition: all 0.15s ease;
        }

        .dd-author-pill:hover {
            color: #ffffff;
            background: rgba(167, 139, 250, 0.25);
        }

        /* Top posts grid (feed visual) */
        .top-posts-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 20px;
        }

        .post-feed-card {
            background: #111827;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            padding: 18px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
            transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
            position: relative;
        }

        .post-feed-card:hover {
            transform: translateY(-2px);
            border-color: rgba(255, 255, 255, 0.2);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
        }

        .post-feed-card.rank-podium-1 {
            border-color: rgba(234, 179, 8, 0.5);
            background: linear-gradient(180deg, rgba(234, 179, 8, 0.05) 0%, #111827 30%);
            box-shadow: 0 0 15px rgba(234, 179, 8, 0.15);
        }

        .post-feed-card.rank-podium-2 {
            border-color: rgba(203, 213, 225, 0.4);
            background: linear-gradient(180deg, rgba(203, 213, 225, 0.04) 0%, #111827 30%);
        }

        .post-feed-card.rank-podium-3 {
            border-color: rgba(217, 119, 6, 0.4);
            background: linear-gradient(180deg, rgba(217, 119, 6, 0.04) 0%, #111827 30%);
        }

        .pfc-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .pfc-user-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .pfc-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: #0f172a;
            border: 2px solid transparent;
            background-image: linear-gradient(#0f172a, #0f172a), linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
            background-origin: border-box;
            background-clip: content-box, border-box;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.9rem;
            color: #e2e8f0;
            flex-shrink: 0;
        }

        .pfc-username {
            font-weight: 700;
            color: #ffffff;
            text-decoration: none;
            font-size: 0.92rem;
            display: block;
        }

        .pfc-username:hover {
            color: #38bdf8;
            text-decoration: underline;
        }

        .pfc-date {
            font-size: 0.74rem;
            color: #94a3b8;
        }

        .pfc-header-badges {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .pfc-sentiment-pill {
            font-size: 0.72rem;
            font-weight: 700;
            padding: 3px 8px;
            border-radius: 6px;
            letter-spacing: 0.02em;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .pfc-sentiment-pill.sent-pos {
            color: #34d399;
            background: rgba(52, 211, 153, 0.12);
            border: 1px solid rgba(52, 211, 153, 0.3);
        }

        .pfc-sentiment-pill.sent-neu {
            color: #94a3b8;
            background: rgba(148, 163, 184, 0.12);
            border: 1px solid rgba(148, 163, 184, 0.25);
        }

        .pfc-sentiment-pill.sent-neg {
            color: #fb7185;
            background: rgba(251, 113, 133, 0.12);
            border: 1px solid rgba(251, 113, 133, 0.3);
        }

        .select-sentiment-filter {
            font-weight: 600;
            border-color: rgba(139, 92, 246, 0.4) !important;
            background-color: rgba(30, 41, 59, 0.8) !important;
            color: #ffffff !important;
        }

        .pfc-rank-badge {
            font-size: 0.74rem;
            font-weight: 700;
            color: #cbd5e1;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.15);
            padding: 3px 8px;
            border-radius: 6px;
            letter-spacing: 0.02em;
        }

        .pfc-rank-badge.badge-podium {
            color: #fef08a;
            background: rgba(234, 179, 8, 0.15);
            border-color: rgba(234, 179, 8, 0.4);
        }

        .pfc-metrics-bar {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            padding: 8px 10px;
            background: rgba(15, 23, 42, 0.5);
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.04);
        }

        .pfc-metric {
            font-size: 0.8rem;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            color: #e2e8f0;
            padding: 2px 6px;
            border-radius: 4px;
        }

        .pfc-metric small {
            color: #94a3b8;
            font-size: 0.72rem;
        }

        .metric-likes strong {
            color: #f43f5e;
        }

        .metric-comments strong {
            color: #38bdf8;
        }

        .metric-total strong {
            color: #a78bfa;
        }

        .pfc-themes {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .pfc-caption {
            font-size: 0.84rem;
            line-height: 1.45;
            color: #e2e8f0;
            background: rgba(15, 23, 42, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 8px;
            padding: 10px 12px;
        }

        .post-caption-content {
            max-height: 85px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: pre-line;
            transition: max-height 0.3s ease;
        }

        .post-caption-content.expanded {
            max-height: 800px;
        }

        .btn-caption-expand {
            background: transparent;
            border: none;
            color: #38bdf8;
            font-size: 0.76rem;
            font-weight: 600;
            padding: 4px 0 0 0;
            cursor: pointer;
            outline: none;
        }

        .btn-caption-expand:hover {
            text-decoration: underline;
        }

        .pfc-preview-container {
            border-radius: 8px;
            overflow: hidden;
            background: #000000;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .iframe-wrapper {
            position: relative;
            width: 100%;
            height: 480px;
        }

        .instagram-embed-iframe {
            width: 100%;
            height: 480px;
            border: none;
        }

        .pfc-footer {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            margin-top: auto;
            padding-top: 8px;
            border-top: 1px solid rgba(255, 255, 255, 0.06);
        }

        .btn-preview-toggle {
            background: rgba(56, 189, 248, 0.12);
            color: #38bdf8;
            border: 1px solid rgba(56, 189, 248, 0.3);
            font-size: 0.78rem;
            font-weight: 600;
            padding: 6px 10px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.15s ease;
        }

        .btn-preview-toggle:hover {
            background: rgba(56, 189, 248, 0.25);
            color: #ffffff;
        }

        .btn-preview-toggle.active {
            background: rgba(244, 63, 94, 0.15);
            color: #fb7185;
            border-color: rgba(244, 63, 94, 0.35);
        }

        .btn-sm {
            padding: 6px 10px;
            font-size: 0.78rem;
        }

        @media (max-width: 1024px) {
            .sidebar {
                display: none;
            }

            .main-content {
                width: 100%;
                margin-left: 0;
                padding: 22px clamp(16px, 3vw, 30px);
            }

            .grid-2-cols,
            .grid-3-cols,
            .sentiment-kpi-grid,
            .top-posts-grid {
                grid-template-columns: minmax(0, 1fr);
            }

            .deep-dive-kpis {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        @media (max-width: 700px) {
            .main-content {
                padding: 16px 12px;
            }

            .top-header {
                gap: 14px;
            }

            .header-titles h1 {
                font-size: 1.45rem;
            }

            .filter-controls {
                gap: 8px;
                padding: 8px;
            }

            .date-picker-group {
                flex-wrap: wrap;
                min-width: 0;
            }

            .date-picker-group input[type="date"],
            .custom-date-input {
                min-width: 0;
                width: 95px !important;
                padding: 6px 4px;
            }

            .dashboard-module>.section-header {
                align-items: flex-start;
            }

            .module-controls {
                gap: 7px;
            }

            .module-controls .select-input {
                flex: 1 1 140px;
                min-width: 0;
            }

            #table-top-posts tbody {
                grid-template-columns: minmax(0, 1fr);
            }

            .analysis-kpis {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }

            .chart-container {
                height: 320px;
            }
        }