





:root {





    color-scheme: dark;





    --bg-main: hsl(140, 10%, 10%);





    --bg-surface: hsl(140, 10%, 15%);





    --bg-surface-hover: hsl(140, 10%, 20%);





    --color-primary: hsl(142, 70%, 45%);





    --color-primary-hover: hsl(142, 70%, 40%);





    --text-main: hsl(0, 0%, 93%);





    --text-muted: hsl(140, 5%, 70%);





    --border-color: rgba(255, 255, 255, 0.1);





    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);





    





    --border-radius: 12px;





    --border-radius-sm: 8px;





    --transition-speed: 0.3s;





    --sidebar-width: 260px;





    --sidebar-collapsed-width: 80px;





}





body.light-mode {





    color-scheme: light;





    --bg-main: hsl(40, 20%, 97%);





    --bg-surface: hsl(0, 0%, 100%);





    --bg-surface-hover: hsl(40, 20%, 94%);





    --color-primary: hsl(142, 76%, 36%);





    --color-primary-hover: hsl(142, 76%, 30%);





    --text-main: hsl(0, 0%, 15%);





    --text-muted: hsl(0, 0%, 45%);





    --border-color: rgba(0, 0, 0, 0.08);





    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);





}





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





body {





    font-family: 'Inter', sans-serif;





    background-color: var(--bg-main);





    color: var(--text-main);





    line-height: 1.5;





    transition: background-color var(--transition-speed), color var(--transition-speed);





    min-height: 100vh;





}





a { color: var(--color-primary); text-decoration: none; }





a:hover { text-decoration: underline; }





.glass-card {
    display: flex;
    flex-direction: column;
    max-height: 100%; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 1.5rem; box-shadow: var(--shadow); transition: background-color var(--transition-speed), border-color var(--transition-speed); }





/* Botoes e Inputs */





.form-group { margin-bottom: 1.25rem; }





.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 500; color: var(--text-main); }





.form-group input, .form-group select { width: 100%; padding: 0.75rem 1rem; background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); color: var(--text-main); font-size: 1rem; transition: border-color var(--transition-speed); font-family: inherit; }
.form-group textarea { width: 100%; padding: 0.75rem 1rem; background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); color: var(--text-main); font-size: 1rem; transition: border-color var(--transition-speed); font-family: inherit; resize: vertical; min-height: 80px; }
.form-group textarea:focus { outline: none; border-color: var(--color-primary); }





.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--color-primary); }





select option { background-color: var(--bg-surface); color: var(--text-main); }





.btn-primary, .btn-secondary, .btn-success { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1.5rem; border: none; border-radius: var(--border-radius-sm); font-size: 1rem; font-weight: 600; cursor: pointer; transition: background-color var(--transition-speed), transform 0.1s; width: 100%; font-family: inherit; }





.btn-primary { background-color: var(--color-primary); color: #ffffff; }





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





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





.btn-secondary:hover { background-color: var(--bg-surface-hover); }





.btn-success { background-color: #10b981; color: #fff; }





.btn-success:hover { background-color: #059669; }





.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; width: auto; }





.btn-icon { background: transparent; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0.5rem; border-radius: var(--border-radius-sm); transition: all 0.2s; }





.btn-icon:hover { background-color: var(--bg-surface-hover); color: var(--text-main); }





/* Sidebar */





.app-container { display: none; min-height: 100vh; }





.app-container.active { display: flex; }





.sidebar { width: var(--sidebar-width); background-color: var(--bg-surface); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; position: fixed; height: 100vh; left: 0; top: 0; z-index: 10; transition: width var(--transition-speed), background-color var(--transition-speed), border-color var(--transition-speed); overflow-x: hidden; }





.sidebar.collapsed { width: var(--sidebar-collapsed-width); }





.sidebar-header { padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }





.sidebar-header-title { display: flex; align-items: center; gap: 0.5rem; }





.sidebar-header h2 { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; transition: opacity 0.2s; }





.sidebar.collapsed .sidebar-header h2 { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }





.status-indicator { width: 8px; height: 8px; background-color: var(--color-primary); border-radius: 50%; display: inline-block; box-shadow: 0 0 8px var(--color-primary); }





.sidebar-nav { flex: 1; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; }





.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; color: var(--text-muted); text-decoration: none; border-radius: var(--border-radius-sm); transition: all var(--transition-speed); font-weight: 500; cursor: pointer; border: none; background: transparent; width: 100%; text-align: left; font-size: 1rem; font-family: inherit; white-space: nowrap; overflow: hidden; }





.nav-item:hover { background-color: var(--bg-surface-hover); color: var(--text-main); }





.nav-item.active { background-color: rgba(34, 197, 94, 0.1); color: var(--color-primary); }





.sidebar.collapsed .nav-item { justify-content: center; padding: 0.75rem; }





.sidebar.collapsed .nav-item span { display: none; }





.sidebar-footer { padding: 1.25rem 1.5rem; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 0.75rem; }





.sidebar-footer-top { display: flex; flex-direction: row; justify-content: space-between; align-items: center; }





.user-info { font-size: 0.875rem; font-weight: 500; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }





.sidebar.collapsed .user-info { display: none; }





.sidebar.collapsed .sidebar-footer { align-items: center; padding: 1rem 0; }





.sidebar.collapsed .sidebar-footer-top { flex-direction: column; gap: 0.5rem; justify-content: center; }





.sidebar.collapsed #btn-logout span { display: none; }





/* Main */





.main-content { flex: 1; margin-left: var(--sidebar-width);  width: calc(100% - var(--sidebar-width)); transition: margin-left var(--transition-speed), width var(--transition-speed); 





    overflow-y: auto;





    min-height: 100vh;





}





.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed-width); width: calc(100% - var(--sidebar-collapsed-width)); }





.view-pane { display: none; animation: fadeIn 0.3s ease-in-out; padding: 2rem; }





.view-pane.active { display: block; }





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





/* Login */





.login-container { display: none; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; }





.login-container.active { display: flex; }





.login-box { width: 100%; max-width: 400px; }





.error-message { color: #ef4444; font-size: 0.875rem; margin-bottom: 1rem; min-height: 1.25rem; }





/* Views Extras */





.view-header { margin-bottom: 2rem; }





.view-header h2 { font-size: 1.75rem; margin-bottom: 0.25rem; }





.view-header p { color: var(--text-muted); }





/* DASHBOARD */





.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }





.metric-card { flex-direction: row; display: flex; align-items: center; gap: 1.25rem; }





.metric-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; }





.metric-icon.bg-green { background-color: var(--color-primary); }





.metric-icon.bg-blue { background-color: #3b82f6; }





.metric-icon.bg-purple { background-color: #8b5cf6; }





.metric-icon.bg-orange { background-color: #f59e0b; }





.metric-icon.bg-red { background-color: #ef4444; }





.metric-data h3 { font-size: 1.75rem; line-height: 1.2; }





.metric-data p { color: var(--text-muted); font-size: 0.875rem; }





/* LEADS VIEW */





.filter-section {





    display: grid;





    grid-template-columns: 1fr auto auto auto auto;





    gap: 1rem;





    margin-bottom: 1.5rem;





    align-items: end;





}





.search-box { position: relative; width: 100%; }





.search-box svg { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }





.search-box input { width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem; background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); color: var(--text-main); font-family: inherit; }





.search-box input:focus { outline: none; border-color: var(--color-primary); }





.filter-group.inline { display: flex; flex-direction: column; }





.filter-group.inline label { font-size: 0.75rem; margin-bottom: 0.25rem; color: var(--text-muted); }





.filter-group.inline input, .filter-group.inline select { padding: 0.65rem 0.75rem; background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); color: var(--text-main); font-family: inherit; font-size: 0.875rem; }





.filter-group.inline input:focus, .filter-group.inline select:focus { outline: none; border-color: var(--color-primary); }





.table-container { overflow-x: auto; margin-top: 1.5rem; }





table { width: 100%; border-collapse: collapse; }





th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }





th { font-weight: 600; color: var(--text-muted); font-size: 0.875rem; cursor: pointer; user-select: none; }





th:hover { color: var(--text-main); }





.lead-context-badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; background-color: rgba(34, 197, 94, 0.1); color: var(--color-primary); border: 1px solid rgba(34, 197, 94, 0.2); }





.pagination-container { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); font-size: 0.875rem; }





.pagination-buttons { display: flex; gap: 0.5rem; }





/* Outros */





.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }





.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }





.status-box { padding: 1rem; border-radius: var(--border-radius-sm); background-color: rgba(34, 197, 94, 0.1); color: var(--color-primary); border: 1px solid rgba(34, 197, 94, 0.2); display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; }





.list-group { list-style: none; margin-top: 1rem; }





.list-group li { padding: 1rem; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); margin-bottom: 0.5rem; display: flex; justify-content: space-between; align-items: center; }





.status-badge { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; }





.status-badge.active::before { content: ''; width: 8px; height: 8px; background-color: var(--color-primary); border-radius: 50%; }





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





.text-center { text-align: center; }





.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }





.hidden { display: none !important; }





@media (max-width: 1024px) {





    .filter-section { grid-template-columns: 1fr; }





    .config-grid { grid-template-columns: 1fr; }





}





@media (max-width: 768px) {





    .sidebar { width: var(--sidebar-collapsed-width); }





    .sidebar-header h2 { opacity: 0; pointer-events: none; width: 0; }





    .nav-item { justify-content: center; padding: 0.75rem; }





    .nav-item span { display: none; }





    .user-info { display: none; }





    .sidebar-footer { align-items: center; padding: 1rem 0; }





    .sidebar-footer-top { flex-direction: column; gap: 0.5rem; justify-content: center; }





    #btn-logout span { display: none; }





    .main-content { margin-left: var(--sidebar-collapsed-width); width: calc(100% - var(--sidebar-collapsed-width)); padding: 1rem; }





}





/* Flatpickr Overrides */





.flatpickr-calendar { background: var(--bg-surface) !important; border: 1px solid var(--border-color) !important; box-shadow: var(--shadow) !important; margin-top: 8px !important; }





.flatpickr-day { color: var(--text-main) !important; }





.flatpickr-day.selected { background: var(--color-primary) !important; border-color: var(--color-primary) !important; color: #fff !important; }





.flatpickr-day:hover { background: var(--bg-surface-hover) !important; }





.flatpickr-months .flatpickr-month { background: var(--bg-surface) !important; color: var(--text-main) !important; fill: var(--text-main) !important; }





.flatpickr-current-month .flatpickr-monthDropdown-months { background: transparent !important; }





.flatpickr-weekday { color: var(--text-muted) !important; }





span.flatpickr-weekday { color: var(--text-muted) !important; }





/* Dashboard Charts */





.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; margin-top: 1rem; margin-bottom: 2rem; }
.charts-grid > * { min-width: 0; }





.charts-grid h3 { font-size: 1.1rem; margin-bottom: 1rem; font-weight: 600; color: var(--text-main); }





@media (max-width: 1024px) {





    .charts-grid { grid-template-columns: 1fr; }





}





/* ---- Chart containers com altura FIXA (evita loop de resize) ---- */





.chart-wrapper {





    position: relative;





    height: 260px;





    width: 100%;





}





/* ---- Lead badges ---- */





.lead-badge {





    display: inline-block;





    padding: 0.2rem 0.65rem;





    border-radius: 999px;





    font-size: 0.75rem;





    font-weight: 500;





    background-color: rgba(34,197,94,0.12);





    color: var(--color-primary);





    border: 1px solid rgba(34,197,94,0.2);





    white-space: nowrap;





}





.lead-badge.badge-blue {





    background-color: rgba(59,130,246,0.12);





    color: #3b82f6;





    border-color: rgba(59,130,246,0.2);





}





/* ---- Contato na tabela: herda cor do texto, nao azul do browser ---- */





table a { color: var(--color-primary); text-decoration: none; }





table a:hover { text-decoration: underline; }





\n

/* ==========================================================================
   VARREDURA RETROATIVA - MODERN MINIMAL UI (OPEN DESIGN INSPIRED)
   ========================================================================== */

/* HEADER E ESTRUTURA */
.view-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}
.header-titles h2 { margin-bottom: 0.25rem; font-size: 1.6rem; }
.header-titles p { color: var(--text-muted); font-size: 0.95rem; }

.btn-nova {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-nova:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* CARD DE HISTÓRICO FULL WIDTH */
.varredura-history-card {
    display: flex;
    flex-direction: column;
    min-height: 400px;
    padding: 1.5rem 1.8rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 1rem;
}
.history-card-header h3 { font-size: 1.2rem; font-weight: 600; }
.history-count-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* LISTA VAZIA */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}
.empty-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border: 1px solid rgba(255,255,255,0.05);
}
.empty-icon-wrap svg { opacity: 0.6; }
.history-empty h4 { color: var(--text-main); font-size: 1.1rem; margin-bottom: 0.4rem; }
.history-empty p { font-size: 0.9rem; opacity: 0.8; max-width: 300px; line-height: 1.5; }

/* LISTA PREENCHIDA */
.history-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow-y: auto;
    padding-right: 4px;
    max-height: 60vh;
}
.history-list-container::-webkit-scrollbar { width: 6px; }
.history-list-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.hi-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    transition: all 0.2s ease;
}
.hi-item:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(16, 185, 129, 0.3);
}

.hi-left { display: flex; flex-direction: column; gap: 0.5rem; }
.hi-header { display: flex; align-items: center; gap: 0.8rem; }
.hi-title { font-weight: 600; font-size: 1rem; color: var(--text-main); }
.hi-status {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    padding: 0.2rem 0.6rem; border-radius: 4px; letter-spacing: 0.5px;
}
.hi-status.processando { background: rgba(245,158,11,0.15); color: #fbbf24; animation: pulse-warn 2s infinite; }
.hi-status.concluido { background: rgba(16,185,129,0.15); color: #34d399; }
.hi-status.erro { background: rgba(239,68,68,0.15); color: #f87171; }

@keyframes pulse-warn {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.hi-meta {
    display: flex; gap: 1.5rem; font-size: 0.85rem; color: var(--text-muted);
}
.hi-meta-item { display: flex; align-items: center; gap: 0.4rem; }
.hi-date { font-size: 0.75rem; color: var(--text-muted); opacity: 0.7; margin-top: 0.2rem; }

.hi-actions { display: flex; gap: 0.5rem; align-items: center; }
.btn-export {
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main); font-size: 0.8rem; font-weight: 500;
    padding: 0.4rem 0.8rem; border-radius: 6px; cursor: pointer; transition: all 0.2s;
}
.btn-export:hover:not(:disabled) {
    background: var(--color-primary); color: #111; border-color: var(--color-primary);
}
.btn-export:disabled { opacity: 0.3; cursor: not-allowed; }

/* ==========================================================================
   MODAL DE VARREDURA - OVERLAY E CAIXA
   ========================================================================== */

.od-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.od-modal-overlay.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.od-modal-box {
    background: #141716; /* Fundo bem escuro p/ destacar */
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05) inset;
    transform: translateY(0) scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    position: relative;
}

.od-modal-overlay.hidden .od-modal-box {
    transform: translateY(20px) scale(0.96);
}

.od-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.01);
}
.od-modal-header h3 { font-size: 1.1rem; font-weight: 600; margin: 0; color: #fff; }
.od-modal-close {
    background: transparent; border: none; color: var(--text-muted); cursor: pointer;
    padding: 0.4rem; border-radius: 6px; display: flex; align-items: center; transition: 0.2s;
}
.od-modal-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

.od-modal-body { padding: 1.5rem; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.sync-info-box {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 12px;
}
.sync-info-box h5 {
    display: flex; align-items: center; gap: 0.5rem; color: #34d399;
    font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}
.sync-info-box p { font-size: 0.85rem; color: rgba(255,255,255,0.8); margin-bottom: 0.8rem; line-height: 1.4; }
.sync-info-box ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.sync-info-box ul li {
    font-size: 0.8rem; color: var(--text-muted); position: relative; padding-left: 1rem;
}
.sync-info-box ul li::before {
    content: "•"; position: absolute; left: 0; color: #34d399; font-weight: bold;
}

.od-modal-footer { margin-top: 1.5rem; }
.w-full { width: 100%; display: flex; justify-content: center; }
.shadow-glow { box-shadow: 0 0 20px rgba(16,185,129,0.3); }

.status-alert {
    margin-top: 1rem; padding: 0.75rem; text-align: center; font-size: 0.85rem; font-weight: 500;
    border-radius: 8px; background: rgba(245,158,11,0.1); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2);
}

/* RESPONSIVO MÍNIMO */
@media (max-width: 768px) {
    .view-header-flex { flex-direction: column; align-items: flex-start; gap: 1.2rem; }
    .hi-item { grid-template-columns: 1fr; }
    .hi-meta { flex-direction: column; gap: 0.4rem; }
    .hi-actions { justify-content: flex-start; margin-top: 0.5rem; }
    .form-row-2 { grid-template-columns: 1fr; }
}


/* ==========================================================================
   VARREDURA RETROATIVA - 2 CARDS LAYOUT (MATCHING CONEXÕES)
   ========================================================================== */

/* GRID DE 2 COLUNAS */
.varredura-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* CARDS E HEADERS */
.card-header h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.2rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.w-full { width: 100%; display: flex; justify-content: center; }

/* BADGE DO HISTORICO */
.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 1rem;
    margin-bottom: 0;
}
.history-count-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* SYNC INFO BOX */
.sync-info-box {
    padding: 1rem;
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 8px;
}
.sync-info-box h5 {
    display: flex; align-items: center; gap: 0.5rem; color: #34d399;
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 0.8rem;
}
.sync-info-box ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.sync-info-box ul li { font-size: 0.8rem; color: var(--text-muted); position: relative; padding-left: 1rem; }
.sync-info-box ul li::before { content: "•"; position: absolute; left: 0; color: #34d399; font-weight: bold; }

/* HISTORICO LISTA VAZIA */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-icon-wrap {
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05);
    display: flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.empty-icon-wrap svg { opacity: 0.6; }
.history-empty h4 { color: var(--text-main); font-size: 1rem; margin-bottom: 0.2rem; }
.history-empty p { font-size: 0.85rem; opacity: 0.8; }

/* HISTORICO LISTA PREENCHIDA */
.history-list-container {
    display: flex; flex-direction: column; gap: 0.8rem;
    overflow-y: auto; padding-right: 4px; max-height: 50vh;
}
.history-list-container::-webkit-scrollbar { width: 4px; }
.history-list-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.hi-item {
    display: flex; flex-direction: column; gap: 0.8rem;
    padding: 1rem; background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05); border-radius: 8px;
}

.hi-header { display: flex; align-items: center; justify-content: space-between; }
.hi-title { font-weight: 600; font-size: 0.95rem; color: var(--text-main); }
.hi-status {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
    padding: 0.2rem 0.5rem; border-radius: 4px;
}
.hi-status.processando { background: rgba(245,158,11,0.15); color: #fbbf24; animation: pulse-warn 2s infinite; }
.hi-status.concluido { background: rgba(16,185,129,0.15); color: #34d399; }
.hi-status.erro { background: rgba(239,68,68,0.15); color: #f87171; }

.hi-meta { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; color: var(--text-muted); }
.hi-meta-item { display: flex; align-items: center; gap: 0.4rem; }

.hi-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.2rem; }
.hi-date { font-size: 0.7rem; color: var(--text-muted); opacity: 0.7; }
.hi-actions { display: flex; gap: 0.4rem; }
.btn-export {
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main); font-size: 0.75rem; padding: 0.3rem 0.6rem; border-radius: 6px; cursor: pointer; transition: all 0.2s;
}
.btn-export:hover:not(:disabled) { background: var(--color-primary); color: #111; border-color: var(--color-primary); }
.btn-export:disabled { opacity: 0.3; cursor: not-allowed; }

/* RESPONSIVO */
@media (max-width: 900px) {
    .varredura-grid { grid-template-columns: 1fr; }
}


/* Sidebar Footer Actions styling (Antigravity correction) */
.footer-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.sidebar.collapsed .footer-actions {
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

/* Light mode contrast fixes (Antigravity) */
body.light-mode .hi-item {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .hi-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(16, 185, 129, 0.25);
}
body.light-mode .btn-export {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}
body.light-mode .varredura-history-card {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

.flatpickr-input, .flatpickr-alt-input {
    color: var(--text-main) !important;
    background: var(--bg-surface) !important;
}


/* Scrollbars no Traqueamento, Varreduras e Conexões (Antigravity) */
#view-regras .table-responsive,
#varredura-history-list,
#instances-list {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

#view-regras .table-responsive::-webkit-scrollbar,
#varredura-history-list::-webkit-scrollbar,
#instances-list::-webkit-scrollbar {
    width: 6px;
}

#view-regras .table-responsive::-webkit-scrollbar-thumb,
#varredura-history-list::-webkit-scrollbar-thumb,
#instances-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

#view-regras .table-responsive::-webkit-scrollbar-track,
#varredura-history-list::-webkit-scrollbar-track,
#instances-list::-webkit-scrollbar-track {
    background: transparent;
}

/* Custom Toast Notifications */
.custom-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 350px;
    word-wrap: break-word;
}
.custom-toast.show {
    opacity: 1;
    transform: translateY(0);
}
.custom-toast.toast-error {
    background: #ef4444;
    color: white;
}
.custom-toast.toast-success {
    background: #22c55e;
    color: white;
}
.custom-toast.toast-info {
    background: #3b82f6;
    color: white;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
