/* ============================================================
   RadarGov — Design System & Styles
   Premium dark dashboard with glassmorphism
   ============================================================ */

:root {
    /* Colors */
    --bg-primary: #0a0b14;
    --bg-secondary: #12131f;
    --bg-card: rgba(18, 19, 35, 0.85);
    --bg-card-hover: rgba(24, 26, 48, 0.95);
    --bg-sidebar: rgba(10, 11, 22, 0.97);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-hover: rgba(255, 255, 255, 0.08);

    --text-primary: #e8e9f3;
    --text-secondary: #8b8da3;
    --text-muted: #5a5c72;

    --accent-blue: #6366f1;
    --accent-purple: #a855f7;
    --accent-green: #22c55e;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;

    --gradient-primary: linear-gradient(135deg, #6366f1, #a855f7);
    --gradient-green: linear-gradient(135deg, #22c55e, #06b6d4);
    --gradient-orange: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-blue: linear-gradient(135deg, #3b82f6, #6366f1);

    /* Spacing */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 14px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.5); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    backdrop-filter: blur(20px);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--glass-border);
}

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

.logo-icon {
    width: 40px; height: 40px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    letter-spacing: -0.03em;
}

.logo-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--gradient-primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.status-dot.active {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: rgba(10, 11, 20, 0.6);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.breadcrumb-org {
    color: var(--text-muted);
}

.breadcrumb svg {
    color: var(--text-muted);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 8px 14px;
    width: 280px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.05);
}

.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    width: 100%;
    font-family: inherit;
}

.search-box input::placeholder { color: var(--text-muted); }

.topbar-btn {
    width: 38px; height: 38px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}

.topbar-btn:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: -3px; right: -3px;
    width: 16px; height: 16px;
    background: var(--accent-red);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content */
.content-wrapper {
    padding: 24px 28px 40px;
}

.section { display: none; }
.section.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.kpi-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.kpi-card.highlight {
    border-color: rgba(168, 85, 247, 0.3);
    background: rgba(168, 85, 247, 0.06);
}

.kpi-card.highlight:hover {
    border-color: rgba(168, 85, 247, 0.5);
}

.kpi-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon.blue { background: rgba(99, 102, 241, 0.12); color: #818cf8; }
.kpi-icon.green { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.kpi-icon.purple { background: rgba(168, 85, 247, 0.12); color: #c084fc; }
.kpi-icon.orange { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }

.kpi-info { display: flex; flex-direction: column; gap: 4px; }

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.kpi-change {
    font-size: 0.78rem;
    font-weight: 600;
}

.kpi-change.positive { color: var(--accent-green); }
.kpi-change.neutral { color: var(--text-muted); }
.kpi-change.urgent { color: var(--accent-orange); animation: pulse 2s infinite; }

/* ============================================================
   CHARTS
   ============================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(10px);
    margin-bottom: 16px;
    position: relative;
}

.chart-card canvas {
    max-width: 100%;
    max-height: 100%;
}

.chart-card.wide { grid-column: span 1; }

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chart-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-actions {
    display: flex;
    gap: 6px;
}

.chip {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.chip:hover { background: var(--glass-hover); }
.chip.active {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.3);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.view-all {
    font-size: 0.82rem;
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.view-all:hover { color: var(--accent-purple); }

/* ============================================================
   ALERT BANNER
   ============================================================ */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.alert-icon { color: var(--accent-orange); flex-shrink: 0; }

.alert-content {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.alert-content strong { color: var(--accent-orange); }

.alert-action {
    padding: 8px 20px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: var(--transition);
}

.alert-action:hover { transform: scale(1.03); box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3); }

/* ============================================================
   TABLES
   ============================================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-select {
    padding: 8px 12px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.filter-select option { background: var(--bg-secondary); }

.btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.mini-table-wrapper { overflow-x: auto; }

.data-table, .mini-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .mini-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--glass-border);
}

.data-table td, .mini-table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tr:hover td, .mini-table tr:hover td {
    background: rgba(99, 102, 241, 0.04);
    color: var(--text-primary);
}

.data-table tr { cursor: pointer; transition: var(--transition); }

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.ativo {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
}

.status-badge.encerrado {
    background: rgba(139, 141, 163, 0.12);
    color: var(--text-muted);
}

.status-badge.vencendo {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

.category-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-block;
}

.category-badge.infra { background: rgba(6, 182, 212, 0.12); color: #22d3ee; }
.category-badge.ti { background: rgba(99, 102, 241, 0.12); color: #a5b4fc; }
.category-badge.servicos { background: rgba(168, 85, 247, 0.12); color: #c084fc; }
.category-badge.capacitacao { background: rgba(34, 197, 94, 0.12); color: #4ade80; }

/* ============================================================
   BUDGET SECTION
   ============================================================ */
.budget-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.budget-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
}

.budget-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.budget-bar-container { margin-bottom: 16px; }

.budget-bar {
    height: 24px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    display: flex;
    overflow: hidden;
    margin-bottom: 12px;
}

.budget-bar-fill {
    height: 100%;
    transition: width 1s ease;
}

.budget-bar-fill.empenhado { background: var(--accent-blue); }
.budget-bar-fill.liquidado { background: var(--accent-purple); }
.budget-bar-fill.pago { background: var(--accent-green); }

.budget-bar-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.empenhado-dot { background: var(--accent-blue); }
.liquidado-dot { background: var(--accent-purple); }
.pago-dot { background: var(--accent-green); }

.budget-total {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.highlight-value { color: var(--accent-orange); font-size: 1.1rem; }

.meta-cnj {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.meta-item { display: flex; flex-direction: column; gap: 6px; }

.meta-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.meta-bar {
    height: 32px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    overflow: hidden;
}

.meta-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    border-radius: 8px;
    transition: width 1.2s ease;
}

.meta-fill.target { background: var(--gradient-green); }
.meta-fill.current { background: var(--gradient-orange); }

.meta-gap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.meta-gap strong { color: var(--accent-red); }

/* ============================================================
   CONTACTS
   ============================================================ */
.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.contact-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}

.contact-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.contact-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.contact-avatar {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.contact-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.contact-role {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--glass-border);
}

.contact-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.contact-detail svg { color: var(--text-muted); flex-shrink: 0; }

.contact-detail a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: var(--transition);
}

.contact-detail a:hover { color: var(--accent-purple); }

.contact-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.contact-btn {
    flex: 1;
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: var(--transition);
}

.contact-btn.primary {
    background: var(--gradient-primary);
    color: white;
}

.contact-btn.secondary {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.contact-btn:hover { transform: scale(1.02); }

.enriched-badge {
    padding: 3px 8px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #4ade80;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 12px;
    margin-left: auto;
}

/* ============================================================
   OPPORTUNITIES
   ============================================================ */
.opportunities-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.opportunity-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.opportunity-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(4px);
}

.opp-score {
    width: 56px; height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.opp-score::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid;
    border-color: inherit;
    opacity: 0.3;
}

.opp-score.high { background: rgba(34, 197, 94, 0.2); color: #4ade80; border-color: #4ade80; }
.opp-score.medium { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border-color: #fbbf24; }
.opp-score.low { background: rgba(239, 68, 68, 0.2); color: #f87171; border-color: #f87171; }

.opp-content { flex: 1; }
.opp-title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.opp-description { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.5; }

.opp-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.opp-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-green);
}

.opp-deadline {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    width: 32px; height: 32px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

.modal-content h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding-right: 32px;
}

.modal-content p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.6;
}

.modal-content strong { color: var(--text-primary); }

/* ============================================================
   SOURCE BADGES (Rastreabilidade)
   ============================================================ */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 500;
    color: #a5b4fc;
    cursor: help;
    transition: var(--transition);
    white-space: nowrap;
    margin-top: 4px;
}

.source-badge:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
}

.source-badge.lg {
    font-size: 0.78rem;
    padding: 4px 14px;
}

.source-badge[data-source="api"] { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.2); color: #4ade80; }
.source-badge[data-source="loa"] { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.source-badge[data-source="cnj"] { background: rgba(168, 85, 247, 0.08); border-color: rgba(168, 85, 247, 0.2); color: #c084fc; }
.source-badge[data-source="ejud"] { background: rgba(6, 182, 212, 0.08); border-color: rgba(6, 182, 212, 0.2); color: #22d3ee; }
.source-badge[data-source="calc"] { background: rgba(139, 141, 163, 0.08); border-color: rgba(139, 141, 163, 0.2); color: #8b8da3; }
.source-badge[data-source="pncp"] { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }

/* ============================================================
   PAC SECTION
   ============================================================ */
.pac-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pac-eixo {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(10px);
}

.pac-eixo-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.pac-eixo-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.pac-eixo-icon.direito { background: rgba(99, 102, 241, 0.12); }
.pac-eixo-icon.admin { background: rgba(34, 197, 94, 0.12); }
.pac-eixo-icon.contemporaneo { background: rgba(168, 85, 247, 0.12); }

.pac-eixo-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pac-eixo-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.pac-temas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.pac-tema {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.pac-tema:hover {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.15);
}

.pac-tema-priority {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pac-tema-priority.alta { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
.pac-tema-priority.media { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.pac-tema-priority.baixa { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.4); }

.pac-tema-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pac-tema-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pac-tema-publico {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.pac-tema-source {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

/* Legal Grid */
.legal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.legal-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.legal-card:hover {
    background: rgba(168, 85, 247, 0.04);
    border-color: rgba(168, 85, 247, 0.15);
}

.legal-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.legal-info {
    flex: 1;
}

.legal-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 4px;
}

.legal-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.legal-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--accent-blue);
    text-decoration: none;
}

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

/* Sources Grid */
.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.source-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.source-card:hover {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.15);
}

.source-card-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.source-card-info {
    flex: 1;
}

.source-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.source-card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 6px;
}

.source-card-url {
    font-size: 0.72rem;
    color: var(--accent-blue);
    text-decoration: none;
    word-break: break-all;
}

.source-card-url:hover { text-decoration: underline; }

.source-card-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 4px;
}

.source-card-badge.verified { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.source-card-badge.estimated { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }

/* ============================================================
   ORG SELECTOR
   ============================================================ */
.org-selector {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
}
.org-selector:hover { border-color: rgba(99, 102, 241, 0.4); }
.org-selector:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.org-selector option { background: var(--bg-secondary); color: var(--text-primary); }

/* ============================================================
   ROI CALCULATOR
   ============================================================ */
.roi-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.roi-controls .chart-card h3 { margin-bottom: 20px; font-size: 1rem; }
.roi-slider-group {
    margin-bottom: 20px;
}
.roi-slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.roi-slider-value {
    color: var(--accent-blue);
    font-weight: 700;
}
.roi-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}
.roi-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}
.roi-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.roi-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.roi-card.main {
    grid-column: span 2;
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}
.roi-card-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.roi-card-value {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.roi-card.main .roi-card-value { font-size: 2.4rem; }
.roi-card-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   PIPELINE / TIMELINE
   ============================================================ */
.pipeline-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.pipeline-stage {
    flex: 1;
    min-width: 180px;
}
.pipeline-stage-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border: 1px solid var(--glass-border);
    border-bottom: 2px solid;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pipeline-stage:nth-child(1) .pipeline-stage-header { border-bottom-color: var(--accent-blue); }
.pipeline-stage:nth-child(2) .pipeline-stage-header { border-bottom-color: var(--accent-purple); }
.pipeline-stage:nth-child(3) .pipeline-stage-header { border-bottom-color: var(--accent-orange); }
.pipeline-stage:nth-child(4) .pipeline-stage-header { border-bottom-color: var(--accent-green); }
.pipeline-stage:nth-child(5) .pipeline-stage-header { border-bottom-color: var(--accent-cyan); }
.pipeline-stage-count {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-blue);
    font-size: 0.72rem;
    display: flex; align-items: center; justify-content: center;
}
.pipeline-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--glass-border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    min-height: 80px;
}
.pipeline-item {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: default;
    transition: var(--transition);
}
.pipeline-item:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}
.pipeline-item .score-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 4px;
}
.score-high { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.score-medium { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.score-low { background: rgba(139, 141, 163, 0.15); color: #8b8da3; }

/* ============================================================
   ALERTS LIST
   ============================================================ */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.alert-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.alert-item:hover {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.15);
}
.alert-item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.alert-item-info { flex: 1; }
.alert-item-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.alert-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.alert-item-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.alert-item-tag {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
}
.alert-item-tag.novo { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.alert-item-tag.aberto { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.alert-item-tag.info { background: rgba(99, 102, 241, 0.12); color: #a5b4fc; }

/* ============================================================
   COMPETITORS
   ============================================================ */
.competitors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.competitor-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}
.competitor-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}
.competitor-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}
.competitor-avatar {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.competitor-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.competitor-cnpj {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.competitor-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.competitor-stat {
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    text-align: center;
}
.competitor-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.competitor-stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.competitor-strength {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
}
.competitor-strength.forte { background: rgba(239, 68, 68, 0.06); border: 1px solid rgba(239, 68, 68, 0.15); color: var(--text-secondary); }
.competitor-strength.medio { background: rgba(245, 158, 11, 0.06); border: 1px solid rgba(245, 158, 11, 0.15); color: var(--text-secondary); }
.competitor-strength.fraco { background: rgba(34, 197, 94, 0.06); border: 1px solid rgba(34, 197, 94, 0.15); color: var(--text-secondary); }

/* ============================================================
   PROPOSAL MODAL
   ============================================================ */
.proposal-modal { max-width: 800px; }
.proposal-content {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
}
.proposal-content h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 20px 0 10px;
}
.proposal-content h3 {
    font-size: 1rem;
    color: var(--accent-blue);
    margin: 16px 0 8px;
}
.proposal-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}
.proposal-content table th, .proposal-content table td {
    padding: 8px 12px;
    border: 1px solid var(--glass-border);
    font-size: 0.82rem;
    text-align: left;
}
.proposal-content table th {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
    font-weight: 600;
}
.proposal-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Score Badge in Opportunities */
.opp-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}
.opp-score.hot { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.opp-score.warm { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.opp-score.cool { background: rgba(34, 197, 94, 0.12); color: #4ade80; }

/* Print styles for proposal */
@media print {
    body { background: white !important; color: black !important; }
    .sidebar, .topbar, .modal-close, .proposal-actions { display: none !important; }
    .modal-overlay { background: white !important; }
    .modal { border: none !important; max-width: 100% !important; box-shadow: none !important; background: white !important; }
    .proposal-content * { color: #333 !important; }
    .proposal-content table th { background: #f0f0f0 !important; }
    .proposal-content table td, .proposal-content table th { border-color: #ccc !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .budget-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }
    .kpi-grid { grid-template-columns: 1fr; }
    .search-box { width: 180px; }
    .section-actions { flex-wrap: wrap; }
    .contacts-grid { grid-template-columns: 1fr; }
}
