/* ── DESIGN SYSTEM & VARIÁVEIS ── */
:root {
    --bg-base: #060913;
    --bg-sidebar: #0b0f19;
    --bg-surface: rgba(15, 22, 38, 0.7);
    --bg-card: rgba(22, 30, 49, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(59, 130, 246, 0.2);
    
    /* Cores de Texto */
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #4b5563;

    /* Acentos Neon */
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.35);
    
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.35);

    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.35);

    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.35);

    --accent-gold: #f59e0b;
    --accent-gold-glow: rgba(245, 158, 11, 0.35);
    
    /* Efeitos */
    --glass-blur: blur(16px);
    --sidebar-width: 220px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

/* ── ELEMENTOS BÁSICOS ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Fix global select options background */
select option {
    background-color: #0f172a !important;
    color: #f3f4f6 !important;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.03) 0%, transparent 55%);
}

/* Scrollbars Global */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── SIDEBAR LATERAL ── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    backdrop-filter: var(--glass-blur);
    z-index: 10;
    overflow-y: auto;
    transition: width 0.3s ease, min-width 0.3s ease, padding 0.3s ease;
}

/* Sidebar collapsed state */
.sidebar.collapsed {
    width: 80px;
    min-width: 80px;
    padding: 24px 10px;
}
.sidebar.collapsed .brand-name, 
.sidebar.collapsed .status-container, 
.sidebar.collapsed .section-title, 
.sidebar.collapsed .nav-btn span, 
.sidebar.collapsed .legend-container {
    display: none;
}
.sidebar.collapsed .nav-btn {
    justify-content: center;
    padding: 12px 0;
}
.sidebar.collapsed .nav-btn i {
    width: auto;
    font-size: 1.2rem;
}
.sidebar.collapsed #sidebar-toggle {
    margin: 0 auto !important;
}
.sidebar.collapsed .brand {
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}
.sidebar.collapsed .brand .brand-full {
    display: none;
}
.sidebar.collapsed .brand .brand-logo-collapsed {
    display: block !important;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.brand-logo {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--accent-blue-glow);
}

.brand-logo i {
    color: #fff;
    font-size: 1.2rem;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Painel de Status */
.status-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.status-label {
    color: var(--text-muted);
}

.status-value {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-value.highlight {
    color: var(--accent-blue);
}

.status-dot-mini {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-mini.green {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
}

.status-dot-mini.blue {
    background: var(--accent-blue);
    box-shadow: 0 0 6px var(--accent-blue);
}

.section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 16px 0 10px 0;
    font-weight: 700;
}

/* Menu de Abas */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 24px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
    width: 100%;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
}

.nav-btn.active {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    box-shadow: inset 0 0 8px rgba(59, 130, 246, 0.05);
}

.nav-btn i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

/* Legenda */
.legend-container {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
}

.legend-badge {
    font-weight: 700;
    font-size: 0.6rem;
    padding: 3px 6px;
    border-radius: 4px;
    min-width: 90px;
    text-align: center;
}

.legend-badge.valido {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.legend-badge.redflag {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.legend-badge.proc {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.legend-text {
    color: var(--text-muted);
}

/* ── ÁREA PRINCIPAL DE CONTEÚDO ── */
.main-content {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.2);
    display: flex;
    flex-direction: column;
}

.content-header {
    height: 80px;
    min-height: 80px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: rgba(11, 15, 25, 0.4);
    backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 5;
}

.header-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Abas SPA (Troca de Telas) */
.tab-content {
    display: none;
    padding: 32px;
    flex: 1;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

#chatbot-screen.active {
    display: flex;
    flex-direction: column;
    padding: 0; /* Chatbot ocupa tudo sem margens extras */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── TELA 1: DASHBOARD LAYOUT ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.02), transparent);
    pointer-events: none;
}

.kpi-card:hover {
    transform: translateY(-2px);
    background: rgba(26, 36, 58, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Paleta dos Ícones KPI */
.kpi-icon.blue { background: rgba(59, 130, 246, 0.1); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.15); }
.kpi-card:hover .kpi-icon.blue { box-shadow: 0 0 15px var(--accent-blue-glow); }

.kpi-icon.purple { background: rgba(139, 92, 246, 0.1); color: var(--accent-purple); border: 1px solid rgba(139, 92, 246, 0.15); }
.kpi-card:hover .kpi-icon.purple { box-shadow: 0 0 15px var(--accent-purple-glow); }

.kpi-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.15); }
.kpi-card:hover .kpi-icon.green { box-shadow: 0 0 15px var(--accent-green-glow); }

.kpi-icon.red { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.15); }
.kpi-card:hover .kpi-icon.red { box-shadow: 0 0 15px var(--accent-red-glow); }

.kpi-icon.gold { background: rgba(245, 158, 11, 0.1); color: var(--accent-gold); border: 1px solid rgba(245, 158, 11, 0.15); }
.kpi-card:hover .kpi-icon.gold { box-shadow: 0 0 15px var(--accent-gold-glow); }

.kpi-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    margin: 4px 0 2px 0;
}

.kpi-subtext {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Grid de Gráficos */
.visuals-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
}

.visual-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-premium);
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #fff;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--accent-blue);
    border-radius: 4px;
    display: inline-block;
}

.chart-container {
    flex: 1;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radial-container {
    min-height: 280px;
}

/* Gráfico de barras ranking ocupa 2 colunas */
.visual-card.bar-card {
    grid-column: span 1;
}

/* Caixa do Console da Engine */
.visual-card.console-card {
    grid-column: span 1;
}

.console-box {
    background: rgba(5, 7, 13, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    overflow-y: auto;
    height: 280px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

.console-line {
    margin-bottom: 6px;
    white-space: pre-wrap;
    word-break: break-all;
}

.console-line:last-child {
    margin-bottom: 0;
}

.c-time { color: var(--text-muted); }
.c-sys { color: var(--accent-purple); font-weight: bold; }
.c-db { color: var(--accent-green); font-weight: bold; }
.c-info { color: var(--accent-blue); }
.c-warn { color: var(--accent-gold); }
.c-err { color: var(--accent-red); font-weight: bold; }

/* ── TELA 2: CHATBOT LAYOUT (ESTILOS COMPLEMENTARES) ── */
.chat-container-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    height: calc(100vh - 80px);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message-row {
    display: flex;
    width: 100%;
}

.message-row.user { justify-content: flex-end; }
.message-row.bot { justify-content: flex-start; }

.message-bubble {
    max-width: min(80%, 750px);
    padding: 16px 20px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 0.88rem;
    box-shadow: var(--shadow-premium);
    word-break: break-word;
}

.user .message-bubble {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.bot .message-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

/* Elementos MD do chat */
.message-bubble p { margin-bottom: 12px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.8rem;
}
.message-bubble th, .message-bubble td {
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    text-align: left;
}
.message-bubble th {
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
}
.message-bubble ul, .message-bubble ol {
    margin-left: 20px;
    margin-bottom: 12px;
}
.message-bubble h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 16px 0 8px 0;
    color: #fff;
}
.message-bubble code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #f472b6;
    font-size: 0.82rem;
}

/* Indicador de carregamento */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

.suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.suggestion-btn {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.18);
    color: #60a5fa;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.suggestion-btn:hover {
    background: rgba(59, 130, 246, 0.16);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

/* Input do Chat */
.chat-input-container {
    padding: 20px 32px 32px 32px;
    border-top: 1px solid var(--border-color);
    background: rgba(11, 15, 25, 0.3);
}

.input-wrapper {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 6px 8px 6px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}

.input-wrapper:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.92rem;
    outline: none;
    padding: 10px 0;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: var(--accent-blue);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.send-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── BOTÕES E PALETA GERAL ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: var(--accent-red);
}

/* ── PLACEHOLDERS PARAS OUTRAS TELAS ── */
.placeholder-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: 24px;
    max-width: 800px;
    margin: 40px auto;
    box-shadow: var(--shadow-premium);
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin-bottom: 24px;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.05);
}

.placeholder-container h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.placeholder-container p {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 500px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.placeholder-container p.accent-text {
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 12px;
}

/* ── RESPONSIVIDADE ── */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .visuals-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    :root { --sidebar-width: 240px; }
    .sidebar { padding: 20px 16px; }
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .content-header { padding: 0 24px; }
    .tab-content { padding: 24px; }
}

@media (max-width: 600px) {
    .sidebar { display: none; }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .content-header { padding: 0 16px; }
    .tab-content { padding: 16px; }
}

/* ── TELA 3: TABELA ANALÍTICA & SIMULADOR DE IMPACTOS ── */
.split-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: calc(100vh - 120px);
    min-height: 0;
}

.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-premium);
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-top {
    flex: 1.1;
}

.panel-bottom {
    flex: 0.9;
}

/* Toolbar de Filtros */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1 1 250px;
}

.search-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.88rem;
}

.search-wrapper input {
    width: 100%;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px 10px 38px;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
}

.search-wrapper input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.15);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group select {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-group select:focus {
    border-color: var(--accent-blue);
}

.btn-refresh {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: rotate(45deg);
}

/* Tabelas de Dados */
.table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    background: rgba(5, 7, 13, 0.2);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}

.data-table th {
    background: #0b0f19;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px 16px;
    color: var(--text-main);
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
}

.data-table tbody tr {
    transition: var(--transition-smooth);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table td strong {
    color: #fff;
    font-weight: 700;
}

.diag-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #60a5fa;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px;
    margin-right: 4px;
    margin-bottom: 4px;
}

.diag-badge.orphan {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--accent-gold);
    animation: pulseGlow 2.5s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.85; box-shadow: 0 0 5px rgba(245, 158, 11, 0.1); }
    50% { opacity: 1; box-shadow: 0 0 10px rgba(245, 158, 11, 0.35); }
}

.btn-simulate {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
    width: 100%;
    justify-content: center;
}

.btn-simulate:hover {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
    box-shadow: 0 0 10px var(--accent-red-glow);
}

.loading-state {
    text-align: center;
    padding: 40px !important;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.loading-state i {
    margin-right: 8px;
    color: var(--accent-blue);
}

/* Painel de Cabeçalho do Painel Inferior */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.panel-header-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header-title i {
    color: var(--accent-red);
    animation: flash 1.5s infinite;
}

@keyframes flash {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; text-shadow: 0 0 8px var(--accent-red); }
}

/* Estado Vazio de Simulação */
.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 20px;
    flex: 1;
}

.empty-state-icon {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.empty-state-container h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.empty-state-container p {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 480px;
    line-height: 1.5;
}

/* Tabela de Impactos */
.impact-table th {
    background: rgba(239, 68, 68, 0.05) !important;
}

.severity-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    text-align: center;
    letter-spacing: 0.5px;
    min-width: 90px;
}

.severity-badge.critical {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.severity-badge.moderate {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.72rem;
    border-radius: 8px;
}

/* ── TELA 4: GRAFO DE CONEXÕES INTERATIVO (VIS.JS) ── */
.graph-layout {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 120px);
    gap: 20px;
    min-height: 0;
}

.graph-main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    min-height: 0;
    box-shadow: var(--shadow-premium);
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background-color: #05070c;
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 0),
        radial-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 0);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
}

#graph-canvas {
    width: 100%;
    height: 100%;
}

/* Checkboxes Cyberpunk */
.layer-toggles {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid var(--border-color);
    padding: 6px 16px;
    border-radius: 10px;
    margin-right: 8px;
}

.cyber-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    transition: var(--transition-smooth);
}

.cyber-checkbox:hover {
    color: #fff;
}

.cyber-checkbox input {
    display: none;
}

.chk-custom {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--text-dark);
    display: inline-block;
    transition: var(--transition-smooth);
    position: relative;
}

.cyber-checkbox input:checked + .chk-custom {
    border-color: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.cyber-checkbox input:checked + .chk-custom::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.chk-custom.harness { color: var(--text-muted); }
.cyber-checkbox input:checked + .chk-custom.harness { color: #9ca3af; }

.chk-custom.diagram { color: var(--accent-blue); }
.cyber-checkbox input:checked + .chk-custom.diagram { color: var(--accent-blue); }

.chk-custom.teste { color: #71717a; }
.cyber-checkbox input:checked + .chk-custom.teste { color: #a1a1aa; }

.legend-color-dot.harness { background: #334155; border: 1px solid #64748b; }
.legend-color-dot.diagram { background: #1d4ed8; border: 1px solid #60a5fa; box-shadow: 0 0 6px var(--accent-blue-glow); }
.legend-color-dot.dtc { background: #065f46; border: 1px solid #34d399; box-shadow: 0 0 6px var(--accent-green-glow); }
.legend-color-dot.teste { background: #27272a; border: 1px solid #71717a; }
.graph-legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(11, 15, 25, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    backdrop-filter: var(--glass-blur);
    z-index: 4;
    box-shadow: var(--shadow-premium);
    pointer-events: none;
}

.legend-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.legend-row:last-child {
    margin-bottom: 0;
}

.legend-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-color-dot.harness { background: #4b5563; border: 1px solid #9ca3af; }
.legend-color-dot.diagram { background: #2563eb; border: 1px solid #60a5fa; box-shadow: 0 0 6px var(--accent-blue-glow); }
.legend-color-dot.dtc { background: #10b981; border: 1px solid #34d399; box-shadow: 0 0 6px var(--accent-green-glow); }

/* Loader de Grafo */
.graph-overlay-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(11, 15, 25, 0.9);
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    z-index: 4;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-premium);
}

.graph-overlay-loader i {
    color: var(--accent-blue);
    margin-right: 8px;
}

/* Inspector Lateral do Grafo */
.graph-inspector {
    width: 320px;
    min-width: 320px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-shadow: var(--shadow-premium);
    backdrop-filter: var(--glass-blur);
}

.inspector-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inspector-header i {
    color: var(--accent-blue);
}

.inspector-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    padding: 20px;
}

.inspector-empty .empty-icon {
    font-size: 2.2rem;
    color: var(--text-dark);
    margin-bottom: 16px;
    animation: pulseIcon 2s infinite ease-in-out;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.08); opacity: 0.8; }
}

.inspector-empty p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.inspector-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.inspector-badge {
    align-self: flex-start;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.inspector-badge.dtc-badge { background: rgba(16, 185, 129, 0.12); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.25); }
.inspector-badge.diagram-badge { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.25); }
.inspector-badge.harness-badge { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); border: 1px solid rgba(255, 255, 255, 0.1); }
.inspector-badge.teste-badge { background: rgba(113, 113, 122, 0.12); color: #a1a1aa; border: 1px solid rgba(113, 113, 122, 0.25); }

/* dtc checkbox */
.chk-custom.dtc { color: var(--accent-green); }
.cyber-checkbox input:checked + .chk-custom.dtc { color: var(--accent-green); }

.inspector-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    line-height: 1.25;
}

.inspector-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 16px;
}

.inspector-section:last-child {
    border-bottom: none;
}

.section-subtitle {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 700;
}

/* Lista de Metadados */
.metadata-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metadata-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.8rem;
    gap: 12px;
}

.metadata-label {
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.metadata-value {
    color: #fff;
    font-weight: 600;
    text-align: right;
    word-break: break-all;
}

/* Lista de Relações */
.relations-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.relations-list li {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.relations-list li:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.relations-list li i {
    font-size: 0.8rem;
}

.relations-list li i.harness { color: var(--text-muted); }
.relations-list li i.diagram { color: var(--accent-blue); }
.relations-list li i.dtc { color: var(--accent-green); }

/* Botão de simular direto do inspector */
.inspector-action-btn {
    margin-top: 6px;
}

.flex-search {
    flex: 1.2 !important;
}

/* ── TELA 5: RENDERIZADOR / VISUALIZADOR SVG ── */
.render-layout {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 120px);
    gap: 16px;
    margin-top: 16px;
}

.render-sidebar.unified-sidebar {
    width: 380px;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: var(--glass-blur);
    overflow: hidden;
    gap: 16px;
}

.dropdown-wrapper {
    position: relative;
}

.render-inspector.unified-inspector {
    width: auto;
    min-width: auto;
    min-height: 0;
    flex: 4 1 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0;
    padding: 16px 0 0 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.sidebar-top-section {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.search-wrapper.render-search {
    flex: 0 0 auto !important;
}

.component-list-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-top: 12px;
    border-radius: 8px;
}

.component-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.component-list li {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.component-list li:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.component-list li.active {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
    font-weight: 600;
}

.component-list li .badge {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

.component-list li.active .badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.render-main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: var(--glass-blur);
    overflow: hidden;
}

/* DTC Single View Toggle */
.dtc-single-view .split-pane:nth-child(2) {
    display: none !important;
}

/* Fullscreen Button */
.btn-fullscreen {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    border: 1px solid #334155;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
}
.btn-fullscreen:hover {
    background: rgba(30, 41, 59, 0.9);
}

.svg-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    overflow: auto;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 10px;
}

.svg-canvas-container svg {
    display: block;
    transform-origin: top left;
}

/* Custom interactive highlighting inside SVG - Light Theme */
.svg-canvas-container svg .node-group {
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.svg-canvas-container svg .node-group rect.comp-rect {
    fill: #ffffff;
    stroke: #2563eb;
    stroke-width: 2px;
}

.svg-canvas-container svg .node-group rect.term-rect {
    fill: #f8fafc;
    stroke: #7c3aed;
    stroke-width: 1.5px;
}

.svg-canvas-container svg .node-group polygon.inline-diamond {
    fill: #fffbeb;
    stroke: #d97706;
    stroke-width: 1.5px;
}

.svg-canvas-container svg .node-group circle.solda-circle {
    fill: #ecfdf5;
    stroke: #059669;
    stroke-width: 1.5px;
}

.svg-canvas-container svg .node-group text {
    fill: #1f2937 !important;
    font-weight: 600;
}

.svg-canvas-container svg .node-group text.pin-label {
    fill: #4b5563 !important;
    font-weight: normal;
}

.svg-canvas-container svg .edge-group {
    transition: opacity 0.3s ease;
}

.svg-canvas-container svg .edge-group polyline.wire-bg {
    stroke: #f1f5f9;
    stroke-width: 6px;
}

.svg-canvas-container svg .edge-group polyline.wire {
    stroke: #334155;
    stroke-width: 2px;
}

.svg-canvas-container svg .edge-group text {
    fill: #1f2937 !important;
    font-weight: 500;
}

.svg-canvas-container svg .edge-group rect {
    fill: #ffffff !important;
    stroke: #cbd5e1 !important;
}

/* Highlight styles applied dynamically */
.svg-canvas-container svg .node-group.active-highlight rect.comp-rect,
.svg-canvas-container svg .node-group.active-highlight rect.term-rect,
.svg-canvas-container svg .node-group.active-highlight polygon.inline-diamond,
.svg-canvas-container svg .node-group.active-highlight circle.solda-circle {
    stroke-width: 3.5px;
    filter: drop-shadow(0 0 6px rgba(37, 99, 235, 0.4)) !important;
    stroke: #2563eb !important;
    fill: #eff6ff !important;
}

.svg-canvas-container svg .edge-group.active-highlight polyline.wire {
    stroke-width: 4px !important;
    stroke: #2563eb !important;
    filter: drop-shadow(0 0 4px rgba(37, 99, 235, 0.3)) !important;
}

.render-inspector {
    width: 350px;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: var(--glass-blur);
    overflow: hidden;
}

.comp-details-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-top: 12px;
}

.comp-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    padding: 2px 6px;
    border-radius: 4px;
}

.comp-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
}

.inspector-table-container {
    flex: 1;
    margin-top: 12px;
    overflow-y: auto;
    border-radius: 8px;
}

.pin-table {
    width: 100%;
}

.pin-table td {
    padding: 8px 10px !important;
    font-size: 0.78rem !important;
}

.pin-table tr {
    transition: var(--transition-smooth);
}

.pin-table tr.highlight-row {
    background: rgba(59, 130, 246, 0.12) !important;
    border-left: 3px solid var(--accent-blue);
}

.pin-table tr.highlight-row td {
    background: transparent !important;
}

.pin-table tr.highlight-row-secondary {
    background: rgba(139, 92, 246, 0.08) !important;
    border-left: 3px solid var(--accent-purple);
}

.pin-destination-badge {
    font-size: 0.68rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
    font-weight: 600;
    display: inline-block;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.pin-destination-badge:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
}

/* ── IMPACT CARDS UI ── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.impact-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.impact-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.impact-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.impact-card-title {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent-red);
}

.impact-card-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.impact-card-body {
    font-size: 1.05rem;
    color: var(--text-main);
    flex: 1;
}

.impact-card-footer {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.orphan-banner {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-left: 4px solid var(--accent-gold);
    border-radius: 6px;
    padding: 20px;
    color: var(--text-main);
    font-size: 1.1rem;
}

/* ── TABELA CLICAVEL ── */
.clickable-row {
    cursor: pointer;
    transition: background 0.2s, border-left 0.2s;
    border-left: 3px solid transparent;
}
.clickable-row:hover {
    background: rgba(59, 130, 246, 0.1);
}
.clickable-row.active {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--accent-blue);
}

/* --- FLOW PANEL V3 STYLES --- */
:root {
    --node-inactive: #334155;
    --node-active: #3b82f6;
    --node-done: #10b981;
}

.glass-panel {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.flow-panel { flex: 1.2; padding: 10px; position: relative; display: flex; flex-direction: column; min-width: 300px; }
.panel-title { margin-bottom: 8px; font-size: 1rem; color: #f8fafc; }
.flow-container { flex: 1; position: relative; border-radius: 8px; background: rgba(15, 23, 42, 0.4); overflow: hidden; }
.flow-lines { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.flow-node { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translate(-50%, -50%); cursor: pointer; z-index: 10; }
.node-circle { width: 50px; height: 50px; border-radius: 50%; background: var(--node-inactive); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #94a3b8; border: 2px solid rgba(255,255,255,0.1); transition: all 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.flow-node:hover .node-circle { transform: scale(1.1); border-color: #94a3b8; }
.flow-node.active .node-circle { background: var(--node-active); color: white; border-color: var(--node-active); box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); }
.flow-node.done .node-circle { background: var(--node-done); color: white; border-color: var(--node-done); }
.node-label { font-size: 0.85rem; font-weight: 500; text-shadow: 0 2px 4px rgba(0,0,0,0.5); white-space: nowrap; }

.context-panel { flex: 2; padding: 10px 15px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.context-info { display: flex; flex-direction: column; gap: 5px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; }
.context-action { display: flex; flex-direction: column; gap: 10px; }
.dropzone { border: 2px dashed rgba(255,255,255,0.1); border-radius: 12px; padding: 20px; text-align: center; color: #94a3b8; cursor: pointer; transition: all 0.2s; background: rgba(255, 255, 255, 0.02); }
.dropzone:hover, .dropzone.dragover { border-color: #3b82f6; background: rgba(59, 130, 246, 0.05); }
.btn-process { background: #3b82f6; color: white; border: none; padding: 12px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-process:hover:not(:disabled) { background: #2563eb; }
.btn-process:disabled { background: var(--node-inactive); color: #94a3b8; cursor: not-allowed; }

.project-form { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; width: 100%; min-width: 0; }
.project-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; width: 100%; }
.project-form input, .project-form select { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(255,255,255,0.1); color: #f8fafc; padding: 6px 10px; border-radius: 6px; font-family: inherit; font-size: 0.85rem; outline: none; box-sizing: border-box; }
.input-group { display: flex; gap: 5px; align-items: center; min-width: 0; width: 100%; box-sizing: border-box; }
.input-group select { flex: 1 1 0px; min-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.btn-add-attr { background: rgba(59, 130, 246, 0.2); border: 1px solid #3b82f6; color: #3b82f6; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; }


/* --- STYLES FOR MULTI-SELECT BADGES --- */
.attr-list-container {
    padding: 0;
    min-width: 0;
}
.badge-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #bae6fd;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.badge-item i.fa-xmark {
    cursor: pointer;
    color: #f87171;
    transition: 0.2s;
    margin-left: 4px;
}
.badge-item i.fa-xmark:hover {
    color: #ef4444;
    transform: scale(1.1);
}


/* --- PROJECT FORM REDESIGN --- */
.project-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.project-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}
.section-divider {
    font-size: 0.75rem;
    color: var(--accent-blue);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 5px;
    margin: 10px 0 5px 0;
}.context-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
}
.context-info {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}
.flow-node.locked {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
    cursor: not-allowed;
}


/* --- FIX FLEX SPACING --- */
.context-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.impact-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.impact-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.impact-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.impact-card-title {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent-red);
}

.impact-card-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.impact-card-body {
    font-size: 1.05rem;
    color: var(--text-main);
    flex: 1;
}

.impact-card-footer {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.orphan-banner {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-left: 4px solid var(--accent-gold);
    border-radius: 6px;
    padding: 20px;
    color: var(--text-main);
    font-size: 1.1rem;
}

/* ── TABELA CLICAVEL ── */
.clickable-row {
    cursor: pointer;
    transition: background 0.2s, border-left 0.2s;
    border-left: 3px solid transparent;
}
.clickable-row:hover {
    background: rgba(59, 130, 246, 0.1);
}
.clickable-row.active {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--accent-blue);
}

/* --- FLOW PANEL V3 STYLES --- */
:root {
    --node-inactive: #334155;
    --node-active: #3b82f6;
    --node-done: #10b981;
}

.glass-panel {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.flow-panel { flex: 1.2; padding: 10px; position: relative; display: flex; flex-direction: column; min-width: 300px; }
.panel-title { margin-bottom: 8px; font-size: 1rem; color: #f8fafc; }
.flow-container { flex: 1; position: relative; border-radius: 8px; background: rgba(15, 23, 42, 0.4); overflow: hidden; }
.flow-lines { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.flow-node { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translate(-50%, -50%); cursor: pointer; z-index: 10; }
.node-circle { width: 50px; height: 50px; border-radius: 50%; background: var(--node-inactive); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #94a3b8; border: 2px solid rgba(255,255,255,0.1); transition: all 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.flow-node:hover .node-circle { transform: scale(1.1); border-color: #94a3b8; }
.flow-node.active .node-circle { background: var(--node-active); color: white; border-color: var(--node-active); box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); }
.flow-node.done .node-circle { background: var(--node-done); color: white; border-color: var(--node-done); }
.node-label { font-size: 0.85rem; font-weight: 500; text-shadow: 0 2px 4px rgba(0,0,0,0.5); white-space: nowrap; }

.context-panel { flex: 2; padding: 10px 15px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.context-info { display: flex; flex-direction: column; gap: 5px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; }
.context-action { display: flex; flex-direction: column; gap: 10px; }
.dropzone { border: 2px dashed rgba(255,255,255,0.1); border-radius: 12px; padding: 20px; text-align: center; color: #94a3b8; cursor: pointer; transition: all 0.2s; background: rgba(255, 255, 255, 0.02); }
.dropzone:hover, .dropzone.dragover { border-color: #3b82f6; background: rgba(59, 130, 246, 0.05); }
.btn-process { background: #3b82f6; color: white; border: none; padding: 12px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-process:hover:not(:disabled) { background: #2563eb; }
.btn-process:disabled { background: var(--node-inactive); color: #94a3b8; cursor: not-allowed; }

.project-form { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; width: 100%; min-width: 0; }
.project-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; width: 100%; }
.project-form input, .project-form select { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(255,255,255,0.1); color: #f8fafc; padding: 6px 10px; border-radius: 6px; font-family: inherit; font-size: 0.85rem; outline: none; box-sizing: border-box; }
.input-group { display: flex; gap: 5px; align-items: center; min-width: 0; width: 100%; box-sizing: border-box; }
.input-group select { flex: 1 1 0px; min-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.btn-add-attr { background: rgba(59, 130, 246, 0.2); border: 1px solid #3b82f6; color: #3b82f6; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; }


/* --- STYLES FOR MULTI-SELECT BADGES --- */
.attr-list-container {
    padding: 0;
    min-width: 0;
}
.badge-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #bae6fd;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.badge-item i.fa-xmark {
    cursor: pointer;
    color: #f87171;
    transition: 0.2s;
    margin-left: 4px;
}
.badge-item i.fa-xmark:hover {
    color: #ef4444;
    transform: scale(1.1);
}


/* --- PROJECT FORM REDESIGN --- */
.project-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.project-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}
.section-divider {
    font-size: 0.75rem;
    color: var(--accent-blue);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 5px;
    margin: 10px 0 5px 0;
}.context-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
}
.context-info {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}
.flow-node.locked {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
    cursor: not-allowed;
}


/* --- FIX FLEX SPACING --- */
.context-info {
    flex: none !important;
    border-right: none !important;
}


/* --- SCROLL FIXES --- */
#flow-screen > div {
    min-height: 0 !important;
}
.flow-container {
    overflow: auto !important;
    min-height: 0 !important;
}

/* --- OPTION MULTIPLE STYLES --- */
select[multiple] {
    height: 85px !important;
    padding: 4px;
    overflow-y: auto;
}
select[multiple] option {
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
select[multiple] option:hover {
    background: rgba(59, 130, 246, 0.1);
}
select[multiple] option:checked {
    background: linear-gradient(0deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.2) 100%);
    color: #4ade80;
    font-weight: bold;
}

.flow-node.partial .node-circle { background: var(--accent-gold); color: white; border-color: var(--accent-gold); box-shadow: 0 0 20px rgba(245, 158, 11, 0.35); }

/* ── CONSTRUTOR DE DIAGRAMAS TABS ── */
.builder-tab-container {
    display: flex;
    gap: 16px;
    height: 100%;
    width: 100%;
    position: relative;
}

.builder-side-panel {
    width: 300px;
    min-width: 300px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease;
    backdrop-filter: var(--glass-blur);
    height: calc(100vh - 120px);
}

.builder-side-panel.collapsed {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    border: none;
}

.builder-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.2);
}

.builder-panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.builder-panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.builder-panel-close:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.builder-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.builder-category-item {
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.4);
}

.builder-category-header {
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    user-select: none;
}

.builder-category-header:hover {
    background: rgba(30, 41, 59, 0.5);
    color: var(--accent-blue);
}

.builder-category-header i.arrow-icon {
    transition: transform 0.3s ease;
}

.builder-category-header.open i.arrow-icon {
    transform: rotate(180deg);
}

.builder-category-content {
    display: none;
    padding: 8px;
    background: rgba(15, 23, 42, 0.2);
    max-height: 250px;
    overflow-y: auto;
}

.builder-category-content.open {
    display: block;
}

.builder-item-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.builder-comp-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 10px;
    text-align: left;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.builder-comp-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-main);
    transform: translateX(2px);
}

.builder-workspace {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    position: relative;
    background: rgba(15, 23, 42, 0.5);
    overflow: hidden;
    height: calc(100vh - 120px);
}

.builder-workspace-header {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.builder-workspace-buttons {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.builder-ctrl-btn {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: var(--glass-blur);
    transition: var(--transition-smooth);
}

.builder-ctrl-btn:hover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.15);
}

.builder-graph-canvas {
    width: 100%;
    height: 100%;
}

.builder-search-input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    padding: 8px 12px;
    font-size: 0.8rem;
    outline: none;
    margin-bottom: 8px;
    transition: var(--transition-smooth);
}

.builder-search-input:focus {
    border-color: var(--accent-blue);
}

.builder-conn-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    transition: var(--transition-smooth);
}

.builder-conn-item:hover {
    border-color: var(--border-highlight);
}

.builder-conn-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.builder-conn-btn-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.builder-conn-btn-remove:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

/* ── REDFLAGS STATUS FLOW STYLING ── */
.flow-node.redflag .node-circle {
    background: var(--accent-red) !important;
    color: white !important;
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5) !important;
}

/* ── BUILDER SIDEBAR USED ELEMENTS INDICATOR ── */
.builder-comp-btn.used {
    background: rgba(16, 185, 129, 0.08) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}
/ *    % %  T E L A   8 :   C O N S T R U T O R   D E   D T C    % %  * /  

/* ── DTC BUILDER STYLES ── */
.dtc-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.dtc-panel {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.dtc-left-panel {
    width: 400px;
    min-width: 300px;
}

.dtc-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    overflow-y: auto;
}

.dtc-form-group {
    margin-bottom: 20px;
}

.dtc-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.dtc-form-group select, .dtc-form-group input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
}

.dtc-form-group select:focus, .dtc-form-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

.dtc-result-box {
    background: rgba(5, 7, 13, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #e2e8f0;
    flex: 1;
    overflow-y: auto;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

.dtc-visual-render {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.dtc-component-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent-blue);
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
    min-width: 180px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.dtc-component-box .dtc-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: #fff;
}

.dtc-component-box .dtc-pin {
    background: var(--accent-blue);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.dtc-connection-line {
    height: 2px;
    background: var(--accent-blue);
    flex: 1;
    margin: 0 20px;
    position: relative;
}

.dtc-connection-line::after {
    content: '';
    position: absolute;
    top: -4px;
    right: 0;
    border-width: 5px 0 5px 8px;
    border-style: solid;
    border-color: transparent transparent transparent var(--accent-blue);
}

.dtc-loading-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}