@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

        body {
            font-family: 'Inter', sans-serif;
            background-color: #f8fafc;
            /* slate-50 */
            color: #0f172a;
            margin: 0;
            overflow: hidden;
        }

        /* Active Notch Reverse Corner Radii - Fixed with Radial Gradients */
        .active-notch::before {
            content: "";
            position: absolute;
            right: 0;
            bottom: 100%;
            width: 24px;
            height: 24px;
            background: radial-gradient(circle at top left, transparent 23.5px, #f8fafc 24px);
            pointer-events: none;
        }

        .active-notch::after {
            content: "";
            position: absolute;
            right: 0;
            top: 100%;
            width: 24px;
            height: 24px;
            background: radial-gradient(circle at bottom left, transparent 23.5px, #f8fafc 24px);
            pointer-events: none;
        }

        /* Inactive Item Spotlight Glow (Wine complementary glow from ds.html) */
        .flashlight-btn {
            position: relative;
            overflow: hidden;
            transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .flashlight-btn::after {
            content: "";
            position: absolute;
            inset: -1px;
            background: radial-gradient(100px circle at var(--mouse-x, 0) var(--mouse-y, 0),
                    rgba(148, 37, 48, 0.35),
                    /* Intensified Wine complementary glow */
                    transparent 50%);
            opacity: 0;
            transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
            pointer-events: none;
            border-radius: inherit;
            z-index: 0;
        }

        .flashlight-btn>* {
            position: relative;
            z-index: 10;
        }

        .flashlight-btn:hover::after {
            opacity: 1;
        }

        /* Floating Sidebar Ambient Life */
        @keyframes float-sidebar {

            0%,
            100% {
                transform: translateY(0);
            }

            50% {
                transform: translateY(-8px);
            }
        }

        /* Nav Load Stagger Animation (Sync with ds.html) */
        .nav-load {
            opacity: 0;
            transform: translateX(-40px);
            filter: blur(4px);
            transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .nav-load.loaded {
            opacity: 1;
            transform: translateX(0);
            filter: blur(0);
        }

        /* Button Entry Stagger (Reveal pattern from ds.html: translateY(2rem)) */
        .nav-item {
            opacity: 0;
            transform: translateY(2rem);
            transition: all 1.0s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .loaded .nav-item {
            opacity: 1;
            transform: translateY(0);
        }

        /* Pulse slow for active item icon */
        .pulse-icon {
            animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
        }

        @keyframes pulse-slow {

            0%,
            100% {
                opacity: 1;
                transform: scale(1);
            }

            50% {
                opacity: 0.85;
                transform: scale(1.05);
            }
        }

        /* AIBI Hover Float & Glow */
        @keyframes aibi-levitate {

            0%,
            100% {
                transform: translateY(0px);
                filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
            }

            50% {
                transform: translateY(-4px);
                filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.8));
            }
        }

        .aibi-levitate {
            animation: aibi-levitate 3.5s ease-in-out infinite;
        }

        /* AIBI Tooltip Entry (ds.html DNA) */
        .aibi-tooltip-entry {
            transform-origin: left center;
            transform: translateX(-30px);
            opacity: 0;
            transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
            pointer-events: none;
        }

        .group:hover .aibi-tooltip-entry {
            transform: translateX(0);
            opacity: 1;
        }

        /* Lettering Mask Reveal (ds.html DNA) */
        .tooltip-text-wrapper {
            overflow: hidden;
            display: inline-block;
            vertical-align: bottom;
        }

        .tooltip-text-content {
            transform: translateY(110%);
            opacity: 0;
            transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.2s ease;
            display: block;
        }

        .group:hover .tooltip-text-content {
            transform: translateY(0);
            opacity: 1;
        }

        /* Main Content Reveal Animations */
        .reveal {
            opacity: 0;
            transform: translateY(30px);
            transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .reveal.active {
            opacity: 1;
            transform: translateY(0);
        }

        .delay-100 {
            transition-delay: 100ms;
        }

        .delay-200 {
            transition-delay: 200ms;
        }

        .delay-300 {
            transition-delay: 300ms;
        }

        .delay-400 {
            transition-delay: 400ms;
        }

        /* Custom Scrollbar for Dark Cards */
        .custom-scrollbar::-webkit-scrollbar {
            width: 5px;
        }

        .custom-scrollbar::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 4px;
            margin-block: 10px;
        }

        .custom-scrollbar::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.3);
            border-radius: 4px;
        }

        .custom-scrollbar::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.5);
        }

        /* Custom Tooltip Styling for Top 5 */
        .map-tooltip-wrapper {
            position: absolute;
            bottom: calc(100% + 15px);
            left: 50%;
            transform: translateX(-50%) translateY(20px) scale(0.9);
            background: linear-gradient(135deg, rgba(37, 30, 51, 0.95) 0%, rgba(20, 15, 28, 0.98) 100%);
            border: 1px solid rgba(255, 255, 255, 0.15);
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
            border-radius: 20px;
            padding: 20px;
            width: max-content;
            min-width: 340px;
            pointer-events: none;
            opacity: 0;
            z-index: 1000;
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            /* Bouncy animation */
            backdrop-filter: blur(12px);
        }

        .map-bubble-wrapper:hover {
            z-index: 1000 !important;
            /* Fix tooltip overlap */
        }

        .map-bubble-wrapper:hover .map-tooltip-wrapper {
            opacity: 1;
            transform: translateX(-50%) translateY(0) scale(1);
        }

        .map-tooltip-wrapper::after {
            content: '';
            position: absolute;
            top: 100%;
            left: 50%;
            margin-left: -10px;
            border-width: 10px;
            border-style: solid;
            border-color: rgba(37, 30, 51, 0.98) transparent transparent transparent;
        }

        /* Staggered Row Animations in Tooltip */
        .tooltip-row {
            opacity: 0;
            transform: translateX(-15px);
            transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .map-bubble-wrapper:hover .tooltip-row {
            opacity: 1;
            transform: translateX(0);
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(1) {
            transition-delay: 0.1s;
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(2) {
            transition-delay: 0.15s;
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(3) {
            transition-delay: 0.2s;
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(4) {
            transition-delay: 0.25s;
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(5) {
            transition-delay: 0.3s;
        }

        /* Dynamic Tooltip Bar Animations via CSS Variables */
        .tooltip-bar-fill {
            width: 0%;
            transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
            /* Bouncy width */
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(1) .tooltip-bar-fill {
            transition-delay: 0.15s;
            width: var(--bar-width);
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(2) .tooltip-bar-fill {
            transition-delay: 0.20s;
            width: var(--bar-width);
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(3) .tooltip-bar-fill {
            transition-delay: 0.25s;
            width: var(--bar-width);
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(4) .tooltip-bar-fill {
            transition-delay: 0.30s;
            width: var(--bar-width);
        }

        .map-bubble-wrapper:hover .tooltip-row:nth-child(5) .tooltip-bar-fill {
            transition-delay: 0.35s;
            width: var(--bar-width);
        }

        /* ===== Map Bubble System ===== */
        .map-bubble-wrapper {
            position: absolute;
            transform: translate(-50%, -50%);
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            z-index: 500 !important;
            cursor: pointer;
        }

        .map-bubble {
            position: absolute;
            border-radius: 50%;
            background: var(--bubble-bg);
            box-shadow: 0 0 20px var(--bubble-glow);
            transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .map-bubble:hover {
            transform: scale(1.3);
            z-index: 600;
        }

        .map-bubble-ping {
            position: absolute;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            opacity: 0.6;
            animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
        }

        .map-bubble-label {
            color: #fff;
            font-family: 'Inter', sans-serif;
            font-size: 8px;
            font-weight: 900;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.6);
            z-index: 10;
            text-align: center;
        }


        /* Animated Matrix Lines (ds.html style) */
        .ft-table td {
            position: relative;
            overflow: hidden;
        }

        /* The horizontal scanning line */
        .ft-table td::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: -100%;
            width: 100%;
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(37,99,235,1), transparent);
            animation: scan-line-x 3s linear infinite;
            opacity: 0.6;
            pointer-events: none;
            z-index: 1;
        }

        /* The vertical scanning line */
        .ft-table td::before {
            content: '';
            position: absolute;
            top: -100%;
            right: 0;
            width: 1px;
            height: 100%;
            background: linear-gradient(180deg, transparent, rgba(168, 85, 247, 0.8), transparent);
            animation: scan-line-y 4s linear infinite;
            opacity: 0.6;
            pointer-events: none;
            z-index: 1;
        }

        /* Hover intensifies the scan */
        .ft-table tbody tr:hover td::after {
            background: linear-gradient(90deg, transparent, rgba(148, 37, 48, 1), transparent);
            height: 2px;
            opacity: 1;
            animation: scan-line-x 1.5s linear infinite;
        }
        .ft-table tbody tr:hover td::before {
            background: linear-gradient(180deg, transparent, rgba(148, 37, 48, 1), transparent);
            width: 2px;
            opacity: 1;
            animation: scan-line-y 1.5s linear infinite;
        }

        @keyframes scan-line-x {
            0% { left: -100%; }
            50% { left: 100%; }
            100% { left: 100%; }
        }

        @keyframes scan-line-y {
            0% { top: -100%; }
            50% { top: 100%; }
            100% { top: 100%; }
        }

        /* Override Leaflet Background */
        .leaflet-container {
            background: transparent !important;
        }

        /* Faixa Etária Table Styles */
        .ft-table-wrapper {
            width: 100%;
            overflow-x: auto;
        }

        .ft-table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
        }

        .kpi-scroll-card {
            max-height: min(720px, calc(100vh - 170px));
            min-height: 320px;
        }

        .kpi-table-shell {
            min-height: 0;
        }

        .kpi-table-scroll {
            max-height: min(540px, 58vh);
            overflow-x: scroll !important;
            overflow-y: auto !important;
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
            touch-action: pan-x pan-y;
            cursor: grab;
            padding-bottom: 12px;
            scrollbar-gutter: stable both-edges;
            scrollbar-width: thin;
            scrollbar-color: rgba(168, 85, 247, 0.85) rgba(255, 255, 255, 0.08);
        }

        .kpi-table-scroll.is-dragging {
            cursor: grabbing;
            user-select: none;
        }

        .kpi-table-scroll::-webkit-scrollbar {
            width: 10px;
            height: 10px;
        }

        .kpi-table-scroll::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.08);
            border-radius: 999px;
        }

        .kpi-table-scroll::-webkit-scrollbar-thumb {
            background: linear-gradient(90deg, rgba(168, 85, 247, 0.95), rgba(178, 48, 60, 0.95));
            border-radius: 999px;
            border: 2px solid rgba(37, 30, 51, 0.95);
        }

        .kpi-table-shell::after {
            content: '';
            position: absolute;
            top: 8px;
            right: 8px;
            bottom: 18px;
            width: 34px;
            pointer-events: none;
            border-radius: 0 18px 18px 0;
            background: linear-gradient(90deg, transparent, rgba(37, 30, 51, 0.72));
            z-index: 35;
        }

        .kpi-table-scroll .ft-table {
            width: 100%;
            min-width: 960px;
        }

        .saldo-table-scroll {
            max-height: min(540px, 60vh) !important;
        }

        .saldo-table-scroll .ft-table {
            min-width: 1080px;
        }

        .kpi-table-scroll thead th {
            position: sticky;
            top: 0;
            z-index: 30;
            background: rgba(37, 30, 51, 0.96);
            backdrop-filter: blur(12px);
        }

        .ft-table th {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: #94a3b8;
            padding: 10px 12px;
            font-weight: 700;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            background: rgba(255,255,255,0.02);
            text-align: right;
            border-right: 1px solid rgba(255,255,255,0.05);
        }

        .ft-table th.center {
            text-align: center;
        }

        .ft-table td {
            padding: 6px 12px;
            font-size: 12px;
            color: #e2e8f0;
            border-bottom: 1px solid rgba(255,255,255,0.03);
            border-right: 1px solid rgba(255,255,255,0.05);
            vertical-align: middle;
            text-align: right;
            font-family: 'JetBrains Mono', monospace;
            white-space: nowrap;
            transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            position: relative;
        }

        .ft-table th:last-child, .ft-table td:last-child {
            border-right: none;
        }

        .ft-table tbody tr:hover td {
            background-color: rgba(255, 255, 255, 0.05);
            border-bottom-color: rgba(148, 37, 48, 0.4);
            border-right-color: rgba(148, 37, 48, 0.4);
            box-shadow: inset 0 -1px 10px rgba(148, 37, 48, 0.15);
        }

        .ft-table tbody tr td:hover {
            background-color: rgba(148, 37, 48, 0.15);
            border-bottom-color: rgba(148, 37, 48, 0.8);
            border-right-color: rgba(148, 37, 48, 0.8);
            box-shadow: inset 0 0 15px rgba(148, 37, 48, 0.3);
            transform: scale(1.02);
            z-index: 10;
        }

        /* Add a drawing animation to the table lines on load */
        @keyframes draw-lines-x {
            0% { border-bottom-color: transparent; }
            50% { border-bottom-color: rgba(148, 37, 48, 0.8); }
            100% { border-bottom-color: rgba(255,255,255,0.03); }
        }

        @keyframes draw-lines-y {
            0% { border-right-color: transparent; }
            50% { border-right-color: rgba(148, 37, 48, 0.8); }
            100% { border-right-color: rgba(255,255,255,0.05); }
        }

        .ft-table td {
            animation: draw-lines-x 2s ease-out forwards, draw-lines-y 2s ease-out forwards;
        }

        /* Stagger animation based on row */
        .ft-table tbody tr:nth-child(1) td { animation-delay: 0.1s; }
        .ft-table tbody tr:nth-child(2) td { animation-delay: 0.2s; }
        .ft-table tbody tr:nth-child(3) td { animation-delay: 0.3s; }
        .ft-table tbody tr:nth-child(4) td { animation-delay: 0.4s; }
        .ft-table tbody tr:nth-child(5) td { animation-delay: 0.5s; }
        .ft-table tbody tr:nth-child(6) td { animation-delay: 0.6s; }
        .ft-table tbody tr:nth-child(7) td { animation-delay: 0.7s; }
        .ft-table tbody tr:nth-child(8) td { animation-delay: 0.8s; }


        .ft-table tbody tr.total-row td {
            font-weight: 700;
            background: rgba(255, 255, 255, 0.04);
            border-top: 1px solid rgba(255,255,255,0.1);
        }

        .ft-table tbody tr td:first-child {
            text-align: center;
            font-family: 'Inter', sans-serif;
            font-weight: 500;
        }

        .table-bar-bg {
            position: relative;
            height: 22px;
            width: 100%;
            display: flex;
            align-items: center;
        }

        .table-bar-fill-left {
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            background: rgba(148, 37, 48, 0.85); /* wine-700 variant */
            width: 0%;
            transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
            z-index: 0;
        }

        .table-bar-fill-right {
            position: absolute;
            top: 0;
            right: 0;
            height: 100%;
            background: rgba(148, 37, 48, 0.85);
            width: 0%;
            transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
            z-index: 0;
        }

        .table-bar-text {
            position: relative;
            z-index: 10;
            width: 100%;
            display: flex;
            justify-content: flex-end;
            padding: 0 4px;
        }

/* Responsive layout overrides */
        * {
            min-width: 0;
        }

        @media (min-width: 901px) and (max-width: 1180px) {
            body > nav {
                left: 16px !important;
                top: 16px !important;
                bottom: 16px !important;
                width: 96px !important;
            }

            body > main {
                padding-left: 136px !important;
                padding-right: 24px !important;
            }
        }

        @media (max-width: 900px) {
            html,
            body {
                height: auto !important;
                min-height: 100%;
                overflow-x: hidden;
            }

            body {
                display: block !important;
                padding-bottom: 96px;
            }

            body > nav {
                left: 0 !important;
                right: 0 !important;
                top: auto !important;
                bottom: 0 !important;
                width: 100% !important;
                height: 78px !important;
                border-radius: 24px 24px 0 0 !important;
                flex-direction: row !important;
                align-items: center !important;
                justify-content: center !important;
                gap: 10px !important;
                padding: 8px 12px !important;
                animation: none !important;
            }

            body > nav > div:first-child,
            body > nav > div:nth-child(2),
            body > nav > div:last-child,
            .aibi-tooltip-entry {
                display: none !important;
            }

            body > nav > div:nth-child(3) {
                flex: 0 1 auto !important;
                width: auto !important;
                display: flex !important;
                flex-direction: row !important;
                align-items: center !important;
                justify-content: center !important;
                gap: 8px !important;
            }

            body > nav .nav-item {
                width: auto !important;
                justify-content: center !important;
            }

            body > nav a,
            body > nav .active-notch {
                width: 54px !important;
                height: 54px !important;
                border-radius: 18px !important;
                transform: none !important;
            }

            body > nav a:hover,
            body > nav .active-notch:hover {
                width: 54px !important;
                transform: none !important;
            }

            .active-notch::before,
            .active-notch::after {
                display: none !important;
            }

            body > main {
                height: auto !important;
                min-height: 100vh;
                padding: 24px 16px 108px !important;
                overflow: visible !important;
            }

            body > main header {
                margin-bottom: 24px !important;
            }

            body > main header h1 {
                font-size: clamp(1.7rem, 8vw, 2.4rem) !important;
                line-height: 1.05 !important;
                overflow-wrap: anywhere;
            }

            body > main header h2 {
                font-size: 1rem !important;
                line-height: 1.4 !important;
            }

            body > main h3 {
                overflow-wrap: anywhere;
            }

            body > main .grid {
                height: auto !important;
                min-height: 0 !important;
            }

            [class*="h-[calc"] {
                height: auto !important;
                min-height: 0 !important;
            }

            [class*="h-[700px]"],
            [class*="h-[300px]"] {
                height: auto !important;
                min-height: 320px !important;
            }

            #mapa-uf {
                height: 55vh !important;
                min-height: 340px !important;
            }

            .ft-table-wrapper {
                overflow-x: scroll !important;
                overflow-y: auto !important;
                -webkit-overflow-scrolling: touch;
                touch-action: pan-x pan-y;
            }

            .ft-table {
                width: max-content;
                min-width: 960px;
            }

            .kpi-scroll-card {
                max-height: min(620px, 72vh) !important;
            }

            .kpi-table-scroll {
                max-height: min(460px, 56vh) !important;
            }

            .saldo-table-scroll .ft-table {
                min-width: 1080px;
            }
        }

        @media (max-width: 480px) {
            body {
                padding-bottom: 88px;
            }

            body > nav {
                height: 70px !important;
                padding: 8px !important;
                gap: 6px !important;
            }

            body > nav > div:nth-child(3) {
                gap: 6px !important;
            }

            body > nav a,
            body > nav .active-notch,
            body > nav a:hover,
            body > nav .active-notch:hover {
                width: 46px !important;
                height: 46px !important;
                border-radius: 16px !important;
            }

            body > nav svg,
            body > nav iconify-icon {
                width: 24px !important;
                height: 24px !important;
                font-size: 24px !important;
            }

            body > main {
                padding: 18px 12px 96px !important;
            }

            [class*="h-[700px]"],
            [class*="h-[300px]"] {
                min-height: 280px !important;
            }

            #mapa-uf {
                min-height: 300px !important;
            }
        }
