/* ==========================================================================
   PALANTIR / ArcGIS / FLUENT ARCHITECTURE DESIGN SYSTEM
   ========================================================================== */
:root {
    --purple-primary: #5c2d91;
    --purple-dark: #3b1c60;
    --purple-soft: #f4effa;
    --orange-accent: #ff671b;
    --orange-soft: #fff3ec;
    
    /* Layering Grays */
    --slate-bg: #f8fafc;
    --border-clean: #e2e8f0;
    --card-pure-white: #ffffff;
    
    /* Typography Palette */
    --color-title: #0f172a;
    --color-body: #334155;
    --color-muted: #64748b;
    
    /* Elevation & Transitions */
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-flat: 0 4px 12px rgba(15, 23, 42, 0.03);
    --shadow-hover: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.03);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    --radius-box: 8px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================================================
   BASE & STRUCTURAL RESET
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--slate-bg);
    color: var(--color-body);
    font-family: var(--font-stack);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

.dash-container {
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 24px;
}

.dash-main {
    padding: 32px 0 64px 0;
}

/* MODERNIZE SCROLLBARS GLOBALLY */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================================
   ANIMATIONS (FADE-IN STAGGER EFFECT)
   ========================================================================== */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-wrapper,
.main-split-layout,
.data-tables-split-grid,
.latest-entries-container {
    animation: fadeInSlide 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.main-split-layout { animation-delay: 0.1s; }
.data-tables-split-grid { animation-delay: 0.2s; }
.latest-entries-container { animation-delay: 0.3s; }

/* ==========================================================================
   TYPOGRAPHY STANDARDIZATION & HEADINGS
   ========================================================================== */
.panel-section-title,
.panel-header-simple h3,
.exec-title-block h2 {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-title);
}

.panel-section-title {
    color: var(--color-muted);
    margin-bottom: 12px;
}

/* ==========================================================================
   GLOBAL STICKY NAVBAR
   ========================================================================== */
.dash-navbar {
    background-color: var(--card-pure-white);
    border-bottom: 1px solid var(--border-clean);
    height: 65px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-link {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--purple-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo-link span { color: var(--orange-accent); }

.nav-badge {
    background-color: var(--slate-bg);
    color: var(--color-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-clean);
}

.btn-nav-back {
    color: var(--purple-primary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid var(--purple-primary);
    padding: 6px 14px;
    border-radius: 4px;
    background: transparent;
    transition: var(--transition-smooth);
}

.btn-nav-back:hover {
    background-color: var(--purple-soft);
    border-color: var(--purple-dark);
    color: var(--purple-dark);
}

/* ==========================================================================
   CARDS & HOVER EFFECTS (.PANEL-CARD & .CARD-HORIZONTAL)
   ========================================================================== */
.panel-card {
    background-color: var(--card-pure-white);
    border: 1px solid var(--border-clean);
    border-radius: var(--radius-box);
    padding: 24px;
    box-shadow: var(--shadow-flat);
    margin-bottom: 20px;
    transition: var(--transition-smooth);
    will-change: transform, box-shadow;
}

.panel-card:last-child { margin-bottom: 0; }

.card-horizontal {
    background-color: var(--card-pure-white);
    border: 1px solid var(--border-clean);
    border-radius: var(--radius-box);
    padding: 18px 20px;
    box-shadow: var(--shadow-subtle);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-smooth);
    will-change: transform, box-shadow;
}

/* Unified Hover State Elevation */
.panel-card:hover,
.card-horizontal:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: #cbd5e1;
}

/* ==========================================================================
   PANEL 4: VISÃO GERAL DO TERRITÓRIO
   ========================================================================== */
.territory-horizontal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.card-horizontal-icon {
    width: 42px;
    height: 42px;
    background-color: var(--slate-bg);
    color: var(--purple-primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-horizontal-icon svg {
    width: 20px;
    height: 20px;
}

.card-horizontal-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.card-h-label {
    font-size: 0.8rem;
    color: var(--color-muted);
    font-weight: 600;
}

.card-h-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-title);
    line-height: 1.2;
}

.card-h-value-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--purple-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-horizontal.accent-orange-border {
    border-left: 3px solid var(--orange-accent);
}

.text-orange {
    color: var(--orange-accent) !important;
    background-color: var(--orange-soft) !important;
}

/* ==========================================================================
   LAYOUT SPLIT PRINCIPAL
   ========================================================================== */
.main-split-layout {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* ==========================================================================
   RESUMO EXECUTIVO AUTOMATIZADO
   ========================================================================== */
.executive-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-clean);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.exec-pre {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--purple-primary);
    letter-spacing: 0.8px;
}

.exec-meta-subtitle {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-top: 2px;
    text-transform: none;
    letter-spacing: normal;
}

.exec-timestamp {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-muted);
    background-color: var(--slate-bg);
    padding: 4px 10px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-clean);
}

.status-dot-green {
    width: 6px;
    height: 6px;
    background-color: #22c55e;
    border-radius: 50%;
}

.exec-bullets {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.exec-bullets li {
    font-size: 0.95rem;
    position: relative;
    padding-left: 16px;
    color: var(--color-body);
}

.exec-bullets li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    width: 5px;
    height: 5px;
    background-color: var(--purple-primary);
    border-radius: 50%;
}

.badge-category-inline {
    background-color: var(--purple-soft);
    color: var(--purple-primary);
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.am-su-suggestion-box {
    background-color: var(--slate-bg);
    border: 1px solid var(--border-clean);
    border-radius: 6px;
    padding: 18px;
}

.suggestion-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-title);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.suggestion-paragraph {
    font-size: 0.92rem;
    color: var(--color-body);
    line-height: 1.5;
    font-style: italic;
}

/* ==========================================================================
   PANEL 9: ASSISTENTE AM-SU + EXEMPLOS SUGERIDOS
   ========================================================================== */
.panel-header-simple {
    margin-bottom: 16px;
}

.panel-desc-simple {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.assistant-search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.assistant-input {
    flex: 1;
    background-color: var(--slate-bg);
    border: 1px solid var(--border-clean);
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 0.92rem;
    font-family: var(--font-stack);
    color: var(--color-title);
    transition: var(--transition-smooth);
}

.assistant-input:focus {
    outline: none;
    border-color: var(--purple-primary);
    background-color: var(--card-pure-white);
    box-shadow: 0 0 0 3px rgba(92, 45, 145, 0.08);
}

.btn-assistant {
    background-color: var(--purple-primary);
    color: var(--card-pure-white);
    border: none;
    border-radius: 4px;
    padding: 0 20px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-assistant:hover {
    background-color: var(--purple-dark);
}

.assistant-examples-container {
    background-color: var(--slate-bg);
    border-radius: 4px;
    padding: 12px 14px;
    border: 1px dashed var(--border-clean);
}

.examples-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-title);
    display: block;
    margin-bottom: 6px;
}

.examples-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.examples-list li {
    font-size: 0.84rem;
    color: var(--color-body);
    position: relative;
    padding-left: 14px;
}

.examples-list li::before {
    content: "•";
    color: var(--purple-primary);
    position: absolute;
    left: 2px;
    font-weight: bold;
}

/* ==========================================================================
   PANEL 6: ALERTAS AM-SU
   ========================================================================== */
.border-b-none { margin-bottom: 12px; }

.alert-status-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-item {
    border-radius: 6px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border-clean);
}

.alert-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.alert-label {
    font-size: 0.75rem;
    color: var(--color-muted);
    font-weight: 600;
}

.alert-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #c2410c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-value-muted {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-body);
}

.alert-warning {
    background-color: var(--orange-soft);
    border-color: rgba(255, 103, 27, 0.15);
}
.alert-warning .alert-icon-wrap {
    background-color: rgba(255, 103, 27, 0.1);
    color: var(--orange-accent);
}

.alert-info {
    background-color: #f0fdf4;
    border-color: rgba(34, 197, 94, 0.15);
}
.alert-info .alert-icon-wrap {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

/* ==========================================================================
   PANEL 5: INDICADORES ESTRATÉGICOS
   ========================================================================== */
.strategic-indicators-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.indicator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.indicator-name {
    font-size: 0.88rem;
    color: var(--color-body);
}

.indicator-number {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-title);
}

.font-text-status {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--color-body);
    background-color: var(--slate-bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-clean);
}

.total-highlight-row {
    border-bottom: none;
    margin-top: 6px;
    padding: 10px 12px;
    background-color: var(--purple-soft);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-highlight-row .indicator-name {
    font-weight: 700;
    color: var(--purple-primary);
}

.total-highlight-row .font-text-status {
    color: var(--purple-primary);
    background-color: rgba(92, 45, 145, 0.08);
    border-color: rgba(92, 45, 145, 0.15);
}

/* ==========================================================================
   ESTILIZAÇÃO DE TABELAS EXECUTIVAS COM STICKY HEADERS
   ========================================================================== */
.data-tables-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.table-scroll-box {
    overflow-y: auto;
    max-height: 380px; /* Define altura limite para gatilho do scroll/sticky */
    position: relative;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
}

.executive-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

/* STICKY HEADER COMPATIBILITY CHROME/SAFARI/EDGE */
.executive-table th {
    color: var(--color-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px;
    border-bottom: 2px solid var(--border-clean);
    background-color: #fafbfe;
    position: sticky;
    top: 0;
    z-index: 10;
}

.executive-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--color-body);
    vertical-align: middle;
}

.executive-table tbody tr:hover td {
    background-color: var(--slate-bg);
}

.table-badge-purple {
    background-color: var(--purple-soft);
    color: var(--purple-primary);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.82rem;
}

.table-text-regular {
    font-weight: 500;
    color: var(--color-title);
}

.text-right { text-align: right; }

/* TABULAR HIGH-CONTRAST NUMERICS */
.font-numeric {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-variant-numeric: tabular-nums;
    color: #020617 !important;
}

.font-bold { font-weight: 700; }
.text-muted-ui { color: var(--color-muted); }

/* ==========================================================================
   FEED DE ÚLTIMAS ESCUTAS REGISTRADAS
   ========================================================================== */
.latest-entries-container {
    margin-bottom: 32px;
}

.flex-space-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stream-badge-ui {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--purple-primary);
    border: 1px solid var(--purple-primary);
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.data-table-feed th, 
.data-table-feed td {
    padding: 14px 12px;
}

.table-cell-message {
    max-width: 450px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
    color: var(--color-body);
}

/* ==========================================================================
   PANEL 8: GERAR RELATÓRIO EXECUTIVO (HOVER GLOW EFFECT)
   ========================================================================== */
.action-footer-panel {
    text-align: center;
    margin: 32px 0 16px 0;
}

.btn-generate-pdf-report {
    background-color: var(--card-pure-white);
    color: var(--color-title);
    border: 1px solid var(--border-clean);
    padding: 14px 36px;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: var(--radius-box);
    cursor: pointer;
    box-shadow: var(--shadow-subtle);
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

/* Advanced Fluent Glass/Glow Micro-Interaction */
.btn-generate-pdf-report:hover {
    border-color: var(--purple-primary);
    color: var(--purple-primary);
    background-color: var(--card-pure-white);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(92, 45, 145, 0.12), var(--shadow-hover);
}

.btn-generate-pdf-report::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 30%;
    height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(25deg);
    transition: none;
}

.btn-generate-pdf-report:hover::after {
    left: 130%;
    transition: all 0.7s cubic-bezier(0.3, 1, 0.2, 1);
}

/* ==========================================================================
   FOOTER DO VISUALIZADOR COM METADADOS MVP
   ========================================================================== */
.dash-footer-ui {
    background-color: var(--card-pure-white);
    border-top: 1px solid var(--border-clean);
    padding: 20px 0;
    font-size: 0.8rem;
    color: var(--color-muted);
}

.footer-grid-ui {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    gap: 12px;
}

.footer-center-meta {
    text-align: center;
    font-weight: 600;
    color: var(--color-title);
}

.footer-grid-ui p:last-child {
    text-align: right;
}

/* ==========================================================================
   MEDIA QUERIES - RESPONSIVIDADE INTERNÍVEL COMPLETISSIMA
   ========================================================================== */
@media (max-width: 1200px) {
    .territory-horizontal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    
    .main-split-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .footer-grid-ui {
        grid-template-columns: 1fr;
    }
    
    .footer-grid-ui p,
    .footer-grid-ui p:last-child {
        text-align: center !important;
    }
}

@media (max-width: 768px) {
    .data-tables-split-grid {
        grid-template-columns: 1fr;
    }
    
    .assistant-search-form {
        flex-direction: column;
    }
    
    .