        /* Lufga Font Definitions */
        @font-face {
            font-family: 'Lufga';
            src: url('../static/fonts/Lufga-Regular.woff') format('woff');
            font-weight: 400;
            font-style: normal;
            font-display: swap;
        }

        @font-face {
            font-family: 'Lufga';
            src: url('../static/fonts/Lufga-Medium.woff') format('woff');
            font-weight: 500;
            font-style: normal;
            font-display: swap;
        }

        @font-face {
            font-family: 'Lufga';
            src: url('../static/fonts/Lufga-SemiBold.woff') format('woff');
            font-weight: 600;
            font-style: normal;
            font-display: swap;
        }

        @font-face {
            font-family: 'Lufga';
            src: url('../static/fonts/Lufga-Bold.woff') format('woff');
            font-weight: 700;
            font-style: normal;
            font-display: swap;
        }

        /* CSS Variables for Theme */
        :root {
            /* Dark Theme (Default) */
            --bg-primary: #000000;
            --bg-secondary: #111111;
            --bg-card: #111111;
            --border-color: #333333;
            --text-primary: #ffffff;
            --text-secondary: #a3a3a3;
            --text-muted: #666666;
            --accent-color: #CCFF00;
            --accent-dark: #88CC00;
            --accent-darker: #88CC00;
            --accent-light: #E8F7D0;
            --scrollbar-track: #1a1a1a;
            --scrollbar-thumb: #ccff00;
            --progress-start: #e8f8d0;
            --progress-end: #ccff00;
            --bg-highlight: #3a3a3a;
            
            /* Squircle Border Radius */
            --radius-sm: 1rem;
            --radius-md: 1.5rem;
            --radius-lg: 2rem;

            /* Grid Gap */
            --grid-gap: 1.5rem;
        }

        @media (min-width: 1920px) {
            :root {
                --grid-gap: 2rem;
            }
        }

        /* Tailwind Overrides for Squircle look */
        .rounded-sm { border-radius: 0.5rem !important; }
        .rounded { border-radius: var(--radius-sm) !important; }
        .rounded-md { border-radius: var(--radius-sm) !important; }
        .rounded-lg { border-radius: var(--radius-md) !important; }
        .rounded-xl { border-radius: var(--radius-lg) !important; }
        .rounded-2xl { border-radius: 2.5rem !important; }

        /* Custom Select Arrow for all dropdowns */
        select {
            appearance: none !important;
            -webkit-appearance: none !important;
            background-repeat: no-repeat !important;
            background-size: 1.125rem !important;
            background-position: right 0.75rem center !important;
            padding-right: 2.5rem !important;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
        }

        [data-theme="light"] select {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
        }

        [data-theme="light"] {
            /* Light Theme */
            --bg-primary: #f8f9fa;
            --bg-secondary: #ffffff;
            --bg-card: #ffffff;
            --border-color: #e5e7eb;
            --text-primary: #1f2937;
            --text-secondary: #4b5563;
            --text-muted: #9ca3af;
            --accent-color: #84CC16;
            --accent-dark: #659900;
            --accent-darker: #84CC16;
            --accent-light: #E8F7D0;
            --scrollbar-track: #f1f3f5;
            --scrollbar-thumb: #84CC16;
            --progress-start: #e8f8d0;
            --progress-end: #84CC16;
            --bg-highlight: #e5e7eb;
        }

        body {
            font-family: 'Lufga', 'Inter', sans-serif;
            background-color: var(--bg-primary);
            color: var(--text-primary);
            overflow-x: hidden;
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        .accent-color {
            color: var(--accent-color);
        }

        .bg-accent-color {
            background-color: var(--accent-color);
        }

        .app-wrapper {
            display: flex;
            min-height: 100vh;
            position: relative;
        }

        /* Hide app wrapper by default if showing login */
        body.show-login .app-wrapper {
            display: none !important;
        }

        /* Removido overlay - header agora se ajusta diretamente */

        .app-menu {
            width: 260px;
            min-width: 260px;
            background-color: var(--bg-secondary);
            border-right: 1px solid var(--border-color);
            position: fixed;
            top: 70px;
            left: 0;
            height: calc(100vh - 70px);
            overflow: hidden;
            z-index: 40;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
        }

        .app-content {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            background-color: var(--bg-primary);
            margin-left: 260px;
            width: calc(100% - 260px);
            min-width: 0;
            transition: margin-left 0.3s ease, width 0.3s ease, background-color 0.3s ease;
            padding-top: 70px;
            overflow-x: hidden;
        }

        #main-content {
            min-width: 0;
            max-width: 100%;
        }

        /* Ajustar conteúdo quando menu está retraído */
        body.menu-collapsed .app-content {
            margin-left: 80px;
            width: calc(100% - 80px);
        }

        .logo-box {
            height: 70px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1rem;
            border-bottom: 1px solid var(--border-color);
            transition: border-color 0.3s ease;
        }

        .header-logo {
            display: flex;
            align-items: center;
            height: 100%;
            transition: opacity 0.3s ease, transform 0.3s ease;
            margin-left: 0;
            padding-left: 0;
        }

        .header-logo:hover {
            opacity: 0.9;
            transform: scale(1.03);
        }

        .header-logo img {
            height: 32px;
            width: auto;
        }

        .sidebar-toggle-header {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            padding: 0.5rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 2.5rem;
            height: 2.5rem;
        }

        .sidebar-toggle-header:hover {
            background-color: var(--accent-color);
            color: #000000;
            border-color: var(--accent-color);
        }

        [data-theme="light"] .sidebar-toggle-header:hover {
            background-color: var(--accent-dark);
            color: #ffffff;
        }

        /* Menu retraído */
        .app-menu.collapsed {
            width: 80px;
            min-width: 80px;
        }

        .app-menu.collapsed .menu-text,
        .app-menu.collapsed .menu-title {
            display: none;
        }

        .app-menu.collapsed .menu-link {
            justify-content: center;
            padding: 0.5rem;
        }

        /* Home View - Metric Cards Menu Dropdown */
        .metric-card-header {
            position: relative;
        }

        .metric-menu-dropdown {
            display: none;
            position: absolute;
            right: 0;
            top: 100%;
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 0.5rem;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
            min-width: 180px;
            z-index: 100;
            margin-top: 0.5rem;
            padding: 0.5rem;
        }

        .metric-menu-dropdown.show {
            display: block;
        }

        .metric-menu-dropdown button {
            width: 100%;
            text-align: left;
            padding: 0.75rem 1rem;
            border: none;
            background: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--text-secondary);
            font-size: 0.875rem;
            border-radius: 0.375rem;
            transition: all 0.2s ease;
        }

        .metric-menu-dropdown button:hover {
            background: var(--bg-secondary);
            color: var(--text-primary);
        }

        /* Modal Overlay */
        #modal-overlay {
            display: none !important;
        }

        #modal-overlay.show {
            display: flex !important;
        }

        /* Home View - Cards hover effect */
        .card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        [data-theme="light"] .card:hover {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        }

        /* Home View - Responsive Grid for Metric Cards */
        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: var(--grid-gap);
            margin-bottom: var(--grid-gap);
        }

        /* Tablets e telas médias: 2 cards por linha */
        @media (max-width: 1200px) {
            .metrics-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        /* Mobile: 1 card por linha */
        @media (max-width: 768px) {
            .metrics-grid {
                grid-template-columns: 1fr;
            }
        }

        /* Telas muito grandes: manter 4 colunas */
        @media (min-width: 1920px) {
            .metrics-grid {
                grid-template-columns: repeat(4, 1fr);
                gap: var(--grid-gap);
            }
        }

        /* Home View - Responsive Header */
        @media (max-width: 768px) {
            #home-view .flex.items-center.justify-between {
                flex-direction: column;
                align-items: flex-start !important;
                gap: 1rem;
            }

            #home-view h1 {
                font-size: 1.5rem !important;
            }

            #dashboard-tenant-select-home {
                font-size: 0.875rem !important;
            }
        }

        /* Quick Access Grid Responsiveness */
        @media (max-width: 768px) {
            #home-view .grid {
                grid-template-columns: 1fr !important;
            }
        }

        @media (min-width: 769px) and (max-width: 1024px) {
            #home-view .grid[style*="grid-template-columns: repeat(auto-fit"] {
                grid-template-columns: repeat(2, 1fr) !important;
            }
        }

        /* Metric Cards - Responsividade interna */
        @media (max-width: 480px) {
            .metrics-grid .card .metric-value {
                font-size: 1.5rem !important;
            }

            .metrics-grid .card h3 {
                font-size: 0.75rem !important;
            }

            .metrics-grid .card {
                padding: 1rem !important;
            }

            .metrics-grid .card .metric-card-header > div:first-child > div:first-child {
                width: 2.5rem !important;
                height: 2.5rem !important;
            }

            .metrics-grid .card .metric-card-header > div:first-child > div:first-child i {
                font-size: 1.25rem !important;
            }
        }

        /* Support Section Responsiveness */
        @media (max-width: 768px) {
            #home-view > div:last-child > div {
                flex-direction: column !important;
                align-items: flex-start !important;
            }

            #home-view > div:last-child > div > div:last-child {
                width: 100%;
                flex-direction: column;
            }

            #home-view > div:last-child > div > div:last-child a {
                width: 100%;
                justify-content: center;
            }
        }

        /* Quick Access Grid with Chart Responsiveness */
        .quick-access-grid {
            display: grid;
            grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
            gap: var(--grid-gap);
            margin-bottom: var(--grid-gap);
        }

        @media (max-width: 1200px) {
            .quick-access-grid {
                grid-template-columns: 1fr;
            }

            .quick-access-grid > div:first-child {
                order: 2;
            }

            .quick-access-grid > div:last-child {
                order: 1;
            }
        }

        @media (max-width: 768px) {
            .quick-access-grid {
                grid-template-columns: 1fr !important;
            }
        }

        .app-menu.collapsed .menu-icon {
            margin: 0;
        }

        /* Botão toggle no final da barra lateral */
        .sidebar-toggle-bottom {
            width: 100%;
            padding: 0.5rem 1rem 1rem 1rem;
            background-color: var(--bg-secondary);
            border-top: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
            margin-top: auto;
            flex-shrink: 0;
        }

        .sidebar-action-btn {
            background-color: transparent;
            border: none;
            color: var(--text-secondary);
            padding: 0.5rem 1rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 0.75rem;
            width: 100%;
            font-size: 0.9375rem;
            font-weight: 500;
            white-space: nowrap;
        }

        .sidebar-action-btn:hover {
            color: var(--text-primary);
            background-color: rgba(204, 255, 0, 0.1);
        }

        [data-theme="light"] .sidebar-action-btn:hover {
            color: var(--text-primary);
            background-color: rgba(132, 204, 22, 0.08);
        }

        #menu-logout:hover {
            color: #ef4444;
            background-color: rgba(239, 68, 68, 0.1);
        }

        [data-theme="light"] #menu-logout:hover {
            color: #dc2626;
            background-color: rgba(239, 68, 68, 0.08);
        }

        .sidebar-action-btn .menu-icon {
            width: 1.25rem;
            height: 1.25rem;
            font-size: 1.25rem;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .sidebar-action-btn .menu-text {
            font-size: 0.9375rem;
            font-weight: 500;
        }

        /* Estado colapsado - esconder texto, centralizar ícone */
        .app-menu.collapsed .sidebar-toggle-bottom {
            padding: 0.5rem 0.75rem 0.75rem 0.75rem;
        }

        .app-menu.collapsed #menu-logout {
            display: none;
        }

        .app-menu.collapsed .sidebar-action-btn {
            justify-content: center;
            padding: 0.5rem;
        }

        .app-menu.collapsed .sidebar-action-btn .menu-text {
            display: none;
        }

        .app-menu.collapsed .sidebar-action-btn .menu-icon {
            display: flex !important;
            width: 1.25rem;
            height: 1.25rem;
            font-size: 1.25rem;
        }

        /* Mobile Menu Toggle Button */
        .mobile-menu-toggle {
            display: none;
            position: fixed;
            bottom: 25px;
            left: 25px;
            width: 56px;
            height: 56px;
            background-color: var(--accent-color);
            color: #000000;
            border-radius: 50%;
            align-items: center;
            justify-content: center;
            z-index: 1000; /* Above most elements */
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            border: none;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .mobile-menu-toggle i {
            font-size: 24px;
        }

        .mobile-menu-toggle:hover {
            transform: scale(1.05);
            background-color: var(--accent-dark);
            color: #ffffff;
        }

        .mobile-menu-toggle:active {
            transform: scale(0.95);
        }

        .mobile-menu-close {
            display: none;
            padding: 1.5rem;
            justify-content: flex-end;
            border-bottom: 1px solid var(--border-color);
        }

        .mobile-menu-close button {
            background: transparent;
            border: none;
            color: var(--text-primary);
            cursor: pointer;
            transition: color 0.2s ease;
        }

        .mobile-menu-close button:hover {
            color: var(--accent-color);
        }

        /* Hover para expandir menu retraído */
        .app-menu.collapsed:hover {
            width: 260px !important;
            min-width: 260px !important;
            box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
        }

        .app-menu.collapsed:hover .menu-text,
        .app-menu.collapsed:hover .menu-title {
            display: block !important;
            animation: fadeIn 0.3s ease-in-out;
        }

        .app-menu.collapsed:hover .menu-link {
            justify-content: flex-start !important;
            padding: 0.5rem 1rem !important;
            transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .app-menu.collapsed:hover .menu-icon {
            margin: 0;
        }

        .app-menu.collapsed:hover .sidebar-toggle-bottom {
            padding: 0.5rem 1rem 1rem 1rem;
            transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .app-menu.collapsed:hover #menu-logout {
            display: flex !important;
            animation: fadeIn 0.3s ease-in-out;
        }

        .app-menu.collapsed:hover .sidebar-action-btn {
            justify-content: flex-start;
            padding: 0.5rem 1rem;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .app-menu.collapsed:hover .sidebar-action-btn .menu-text {
            display: block !important;
            animation: fadeIn 0.3s ease-in-out;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateX(-10px);
            }

            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        .menu {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding: 0.5rem 0;
        }

        .menu-title {
            color: var(--text-muted);
            font-size: 0.75rem;
            padding: 0.25rem 1.5rem;
            font-weight: 600;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            transition: color 0.3s ease;
        }

        .menu-item {
            padding: 0 0.625rem;
        }

        .menu-link {
            color: var(--text-secondary);
            padding: 0.5rem 1rem;
            display: flex;
            align-items: center;
            gap: 0.75rem;
            border-radius: var(--radius-sm);
            transition: all 0.2s ease;
            text-decoration: none;
            white-space: nowrap;
            overflow: hidden;
        }

        .menu-link:hover {
            color: var(--text-primary);
            background-color: rgba(204, 255, 0, 0.1);
        }

        [data-theme="light"] .menu-link:hover {
            color: var(--text-primary);
            background-color: rgba(132, 204, 22, 0.08);
        }

        .menu-link.active {
            color: var(--accent-color);
            background-color: rgba(204, 255, 0, 0.15);
        }

        [data-theme="light"] .menu-link.active {
            color: var(--accent-color);
            background-color: rgba(132, 204, 22, 0.12);
            font-weight: 600;
        }

        .menu-icon {
            width: 1.25rem;
            height: 1.25rem;
            font-size: 1.25rem;
            display: flex;
            align-items: center;
            justify-content: center;
            color: inherit;
            transition: color 0.2s ease;
        }

        [data-theme="light"] .menu-link:not(.active) .menu-icon {
            color: #64748b;
        }

        .menu-text {
            font-size: 0.9375rem;
            font-weight: 500;
        }

        .app-header {
            height: 70px;
            background-color: var(--bg-secondary);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            padding: 0 1.5rem;
            gap: 1rem;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 60;
            transition: background-color 0.3s ease, border-color 0.3s ease;
            width: 100%;
        }

        .card {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            padding: 1.5rem;
        }

        [data-theme="light"] .card {
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .card-title {
            font-size: 1.125rem;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 1rem;
            transition: color 0.3s ease;
        }

        .stat-card {
            background: linear-gradient(135deg, rgba(204, 255, 0, 0.1), rgba(204, 255, 0, 0.05));
            border: 1px solid rgba(204, 255, 0, 0.2);
            padding: 1rem;
            border-radius: var(--radius-sm);
            height: 100%;
            display: flex;
            flex-direction: column;
        }

        [data-theme="light"] .stat-card {
            background: linear-gradient(135deg, rgba(136, 204, 0, 0.1), rgba(136, 204, 0, 0.05));
            border: 1px solid rgba(136, 204, 0, 0.3);
        }

        .stat-card:hover {
            border-color: rgba(204, 255, 0, 0.4);
            background: linear-gradient(135deg, rgba(204, 255, 0, 0.15), rgba(204, 255, 0, 0.08));
        }

        [data-theme="light"] .stat-card:hover {
            border-color: rgba(136, 204, 0, 0.5);
            background: linear-gradient(135deg, rgba(136, 204, 0, 0.15), rgba(136, 204, 0, 0.08));
        }

        .stat-icon {
            width: 2rem;
            height: 2rem;
            border-radius: 50%;
            background: rgba(156, 163, 175, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            font-size: 1rem;
            transition: all 0.3s ease;
            flex-shrink: 0;
        }

        [data-theme="light"] .stat-icon {
            background: rgba(136, 204, 0, 0.15);
            color: var(--accent-color);
        }

        .quick-link-card {
            cursor: pointer;
            text-decoration: none;
            color: inherit;
            display: block;
        }

        .quick-link-card:hover {
            border-color: var(--accent-color);
        }

        .quick-link-card:hover .card-title {
            color: var(--accent-color);
        }

        .quick-link-card:hover .stat-icon {
            background: rgba(204, 255, 0, 0.2);
            transform: scale(1.1);
        }

        [data-theme="light"] .quick-link-card:hover .stat-icon {
            background: rgba(136, 204, 0, 0.25);
        }

        /* Metric Card Styles */
        .metric-card {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            padding: 1rem;
            transition: all 0.3s ease;
            position: relative;
            height: 100%;
            display: flex;
            flex-direction: column;
        }

        .metric-card:hover {
            border-color: var(--accent-color);
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
        }

        [data-theme="light"] .metric-card:hover {
            box-shadow: 0 10px 25px rgba(136, 204, 0, 0.15);
        }

        .metric-card-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 0.75rem;
            position: relative;
        }

        .metric-icon {
            width: 2rem;
            height: 2rem;
            border-radius: 50%;
            background-color: rgba(156, 163, 175, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            font-size: 1rem;
            flex-shrink: 0;
        }

        [data-theme="light"] .metric-icon {
            background-color: rgba(156, 163, 175, 0.3);
            color: var(--text-primary);
        }

        .metric-menu-btn {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 0.25rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0.25rem;
            transition: all 0.2s ease;
        }

        .metric-menu-btn:hover {
            background-color: var(--bg-secondary);
            color: var(--text-primary);
            border-radius: var(--radius-sm);
        }

        /* Menu Dropdown */
        .metric-menu-dropdown {
            position: absolute;
            top: 2.5rem;
            right: 0;
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            min-width: 150px;
            z-index: 100;
            display: none;
            padding: 0.5rem 0;
        }

        .metric-menu-dropdown.show {
            display: block;
        }

        .metric-menu-item {
            padding: 0.5rem 1rem;
            color: var(--text-primary);
            cursor: pointer;
            transition: background-color 0.2s ease;
            font-size: 0.875rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .metric-menu-item:hover {
            background-color: var(--bg-secondary);
        }

        .metric-menu-item i {
            font-size: 0.875rem;
        }

        /* Modal */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            display: none !important;
            align-items: center;
            justify-content: center;
        }

        .modal-overlay.show {
            display: flex !important;
        }

        .modal-content {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            padding: 1.5rem;
            max-width: 500px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
            color: var(--text-primary);
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }

        .modal-title {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--text-primary);
        }

        .modal-header .modal-close {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1.5rem;
            padding: 0;
            width: 2rem;
            height: 2rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0.25rem;
            transition: all 0.2s ease;
        }

        .modal-close:hover {
            background-color: var(--bg-secondary);
            color: var(--text-primary);
        }

        .modal-form-group {
            margin-bottom: 1rem;
        }

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

        .modal-input {
            width: 100%;
            padding: 0.75rem;
            background-color: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            color: var(--text-primary);
            font-size: 1rem;
            transition: border-color 0.2s ease;
        }

        .modal-input:focus {
            outline: none;
            border-color: var(--accent-color);
        }

        .modal-actions {
            display: flex;
            gap: 0.75rem;
            justify-content: flex-end;
            margin-top: 1.5rem;
        }

        .modal-btn {
            padding: 0.75rem 1.5rem;
            border-radius: var(--radius-sm);
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            border: none;
        }

        .modal-btn-primary {
            background-color: var(--accent-color);
            color: #000000;
        }

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

        .modal-btn-secondary {
            background-color: var(--bg-secondary);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
        }

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

        /* Rich Text Editor & Content Styles */
        .rich-text-content ul {
            list-style-type: disc !important;
            padding-left: 1.5rem !important;
            margin-bottom: 1rem !important;
        }

        .rich-text-content ol {
            list-style-type: decimal !important;
            padding-left: 1.5rem !important;
            margin-bottom: 1rem !important;
        }

        .rich-text-content b, .rich-text-content strong {
            font-weight: 700 !important;
        }

        .rich-text-content i, .rich-text-content em {
            font-style: italic !important;
        }

        .rich-text-content u {
            text-decoration: underline !important;
        }

        #analysis-body-editor:empty:before {
            content: "Comece a escrever sua análise aqui...";
            color: var(--text-muted);
            font-style: italic;
        }

        #analysis-body-editor {
            line-height: 1.6;
        }

        #analysis-body-editor ul {
            list-style-type: disc !important;
            padding-left: 1.5rem !important;
        }

        #analysis-body-editor ol {
            list-style-type: decimal !important;
            padding-left: 1.5rem !important;
        }

        #analysis-body-editor b, #analysis-body-editor strong {
            font-weight: 700 !important;
        }

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

        #publish-analysis-modal:not(.hidden) {
            animation: fadeIn 0.3s ease-out forwards;
        }

        .metric-value {
            font-size: 1rem;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 0.25rem;
            line-height: 1.2;
        }

        .metric-label {
            font-size: 0.875rem;
            font-weight: 500;
            color: #ccff00;
            margin-bottom: 0.5rem;
        }

        [data-theme="light"] .metric-label {
            color: var(--text-secondary);
        }

        .metric-progress-section {
            margin-top: 0.75rem;
            padding-top: 0.75rem;
            border-top: 1px solid var(--border-color);
        }

        .metric-progress-label {
            font-size: 0.75rem;
            font-weight: 600;
            color: #ccff00;
            margin-bottom: 0.25rem;
        }

        [data-theme="light"] .metric-progress-label {
            color: var(--text-secondary);
        }

        .metric-progress-bar-container {
            margin-bottom: 0.5rem;
        }

        .metric-progress-bar-wrapper {
            flex: 1;
            height: 12px;
            background-color: var(--border-color);
            border-radius: var(--radius-sm);
            overflow: hidden;
        }

        [data-theme="light"] .metric-progress-bar-wrapper {
            background-color: var(--border-color);
        }

        .metric-progress-bar {
            height: 100%;
            border-radius: var(--radius-sm);
            transition: width 1s ease-in-out;
            background: linear-gradient(90deg, var(--progress-start), var(--progress-end));
        }

        .metric-progress-value {
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--text-primary);
            white-space: nowrap;
            margin-top: 0.25rem;
            text-align: left;
        }

        .text-success {
            color: #20b39a;
        }

        [data-theme="light"] .text-success {
            color: var(--accent-dark);
        }

        /* Sortable Table Headers */
        .sortable-header {
            transition: all 0.2s ease;
        }

        .sortable-header:hover {
            background-color: var(--bg-card);
            color: var(--accent-color) !important;
        }

        .sortable-header.active {
            color: var(--accent-color) !important;
        }

        .sortable-header.active .sort-icon {
            display: inline-block !important;
        }

        .sortable-header .sort-icon.sort-desc {
            transform: rotate(180deg);
        }

        /* Theme Toggle Button */
        .theme-toggle {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            padding: 0.5rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 2.5rem;
            height: 2.5rem;
        }

        .theme-toggle:hover {
            background-color: var(--accent-color);
            color: #000000;
            border-color: var(--accent-color);
        }

        [data-theme="light"] .theme-toggle:hover {
            background-color: var(--accent-dark);
            color: #ffffff;
        }

        /* Scrollbar customization */
        ::-webkit-scrollbar {
            width: 8px;
        }

        ::-webkit-scrollbar-track {
            background: var(--scrollbar-track);
            transition: background 0.3s ease;
        }

        ::-webkit-scrollbar-thumb {
            background: var(--scrollbar-thumb);
            border-radius: var(--radius-sm);
            transition: background 0.3s ease;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--accent-dark);
        }

        /* Dashboard View Styles */
        #dashboard-container {
            border-radius: var(--radius-md);
            overflow: hidden;
        }

        #dashboard-loading {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 400px;
        }

        @keyframes spin {
            from {
                transform: rotate(0deg);
            }

            to {
                transform: rotate(360deg);
            }
        }

        .animate-spin {
            animation: spin 1s linear infinite !important;
            display: inline-block;
        }

        /* Garantir que ícones de loading sempre animem */
        i.animate-spin,
        i[class*="spinner"] {
            animation: spin 1s linear infinite !important;
            display: inline-block;
        }

        /* Mobile menu toggle */
        @media (max-width: 1024px) {
            .mobile-menu-toggle {
                display: flex;
            }

            .mobile-menu-close {
                display: flex;
            }

            .app-menu {
                position: fixed;
                left: -100%;
                top: 0;
                width: 100% !important;
                min-width: 100% !important;
                height: 100vh;
                transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                z-index: 2000;
                background-color: var(--bg-secondary);
            }

            .app-menu.menu-open {
                left: 0;
            }

            .app-content {
                width: 100%;
                margin-left: 0 !important;
                padding-top: 70px;
            }

            .app-header {
                left: 0 !important;
                width: 100% !important;
            }
        }

        /* Garantir que os grids tenham linhas de altura igual */
        .stats-grid,
        .metrics-grid {
            grid-auto-rows: 1fr;
            align-items: stretch;
        }

        .stats-grid>*,
        .metrics-grid>* {
            height: 100%;
        }

        /* Mobile: Cards de métricas em 1 coluna */
        @media (max-width: 640px) {
            .metrics-grid {
                grid-template-columns: 1fr !important;
            }
        }

        /* =====================================================================
           LOGIN SCREEN
           ===================================================================== */
        .login-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #000000 0%, #111111 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            transition: opacity 0.3s ease, visibility 0.3s ease;
        }

        .login-screen.hidden {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }

        .login-container {
            width: 100%;
            max-width: 420px;
            padding: 2rem;
        }

        .login-box {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-lg);
            padding: 2.5rem;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
        }

        .login-header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .login-logo {
            height: 48px;
            width: auto;
            margin-bottom: 1.5rem;
        }

        .login-title {
            font-size: 1.75rem;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 0.5rem;
        }

        .login-subtitle {
            font-size: 0.95rem;
            color: var(--text-secondary);
        }

        .login-form {
            display: flex;
            flex-direction: column;
            gap: var(--grid-gap);
        }

        .login-form-group {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .login-label {
            font-size: 0.875rem;
            font-weight: 500;
            color: var(--text-primary);
        }

        .login-input {
            width: 100%;
            padding: 0.75rem 1rem;
            background-color: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            color: var(--text-primary);
            font-size: 1rem;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
        }

        .login-input:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 3px rgba(204, 255, 0, 0.1);
        }

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

        .login-error {
            padding: 0.75rem;
            background-color: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.3);
            border-radius: 0.5rem;
            color: #ef4444;
            font-size: 0.875rem;
        }

        .login-error.hidden {
            display: none;
        }

        .login-button {
            width: 100%;
            padding: 0.875rem 1.5rem;
            background-color: var(--accent-color);
            color: #000000;
            border: none;
            border-radius: var(--radius-sm);
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 0.2s ease, transform 0.1s ease;
            margin-top: 0.5rem;
        }

        .login-button:hover:not(:disabled) {
            background-color: var(--accent-dark);
            transform: translateY(-1px);
        }

        .login-button:active:not(:disabled) {
            transform: translateY(0);
        }

        .login-button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .login-button-text {
            display: inline-block;
        }

        /* Hide app when showing login */
        body.show-login .app-wrapper {
            display: none;
        }

        /* Light theme adjustments for login */
        [data-theme="light"] .login-screen {
            background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
        }

        [data-theme="light"] .login-box {
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
        }

        /* =====================================================================
           REPORTS VIEW STYLES
           ===================================================================== */
        .reports-container {
            display: grid;
            grid-template-columns: 400px 1fr;
            gap: var(--grid-gap);
            height: calc(100vh - 200px);
        }

        @media (max-width: 1024px) {
            .reports-container {
                grid-template-columns: 1fr;
                height: auto;
            }

            .reports-container>div:first-child {
                max-height: 400px;
            }
        }

        .month-accordion {
            margin-bottom: 0.5rem;
        }

        .month-header {
            user-select: none;
        }

        .month-header i {
            transition: transform 0.2s ease;
        }

        .month-files {
            transition: max-height 0.3s ease;
            overflow: hidden;
        }

        .month-files.expanded {
            max-height: 1000px;
        }

        .report-item {
            transition: all 0.2s ease;
        }

        .report-item.selected {
            background-color: var(--accent-color) !important;
            color: #000000 !important;
            border-color: var(--accent-color) !important;
        }

        .report-item:hover:not(.selected) {
            background-color: var(--bg-card);
        }

        #pdf-viewer-container iframe {
            width: 100%;
            height: 100%;
            border: none;
            min-height: 600px;
        }

        /* Animation for spinner */
        @keyframes spin {
            from {
                transform: rotate(0deg);
            }

            to {
                transform: rotate(360deg);
            }
        }

        .animate-spin {
            animation: spin 1s linear infinite;
        }

        /* =====================================================================
           VIEW CONTENT STYLES
           ===================================================================== */
        .view-content {
            width: 100%;
            box-sizing: border-box;
        }

        .view-content[style*="display: block"] {
            display: block !important;
        }

        /* =====================================================================
           TENANTS VIEW STYLES
           ===================================================================== */
        #tenants-view {
            box-sizing: border-box;
            display: none;
            /* Default hidden */
        }

        #tenants-view[style*="display: block"],
        #tenants-view[style*="display:flex"] {
            display: block !important;
            width: 100% !important;
            min-width: 100% !important;
        }

        /* Garantir que quando a view está visível, ela seja exibida */
        #tenants-view:not([style*="display: none"]) {
            display: block !important;
            width: 100% !important;
            min-width: 100% !important;
        }

        /* Forçar largura quando display block está definido inline */
        #tenants-view[style*="display: block"] {
            width: 100% !important;
            min-width: 100% !important;
            max-width: 100% !important;
        }

        #tenants-view .container-fluid {
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }

        #tenants-list {
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
            display: block;
        }

        .tenant-card {
            background-color: var(--bg-card);
            border: 1px solid #4d4d4d;
            border-radius: var(--radius-sm);
            padding: 1rem;
            margin-bottom: 1rem;
            width: 100%;
            box-sizing: border-box;
            display: block;
            min-height: 150px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }

        [data-theme="light"] .tenant-card {
            border-color: #d1d5db;
        }

        .tenant-card:last-child {
            margin-bottom: 0;
        }

        /* Modal styles for tenants */
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .modal[style*="display: flex"] {
            display: flex !important;
        }

        .modal-content {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 0.75rem;
            padding: 1.5rem;
            max-width: 600px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
            box-sizing: border-box;
            color: var(--text-primary);
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }

        .modal-title {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--text-primary);
        }

        .modal-header .modal-close {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1.5rem;
            padding: 0;
            width: 2rem;
            height: 2rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0.25rem;
            transition: all 0.2s ease;
        }

        .modal-close:hover {
            background-color: var(--bg-secondary);
            color: var(--text-primary);
        }

        .modal-body {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .form-label {
            font-size: 0.875rem;
            font-weight: 500;
            color: var(--text-primary);
        }

        .form-input {
            width: 100%;
            padding: 0.75rem;
            background-color: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 0.5rem;
            color: var(--text-primary);
            font-size: 1rem;
            transition: border-color 0.2s ease;
            box-sizing: border-box;
        }

        .form-input:focus {
            outline: none;
            border-color: var(--accent-color);
        }

        .form-help {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        .modal-footer {
            display: flex;
            gap: 0.75rem;
            justify-content: flex-end;
            margin-top: 1.5rem;
        }

        .btn-primary {
            padding: 0.75rem 1.5rem;
            background-color: var(--accent-color);
            color: #000000;
            border: none;
            border-radius: 0.5rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
        }

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

        .btn-secondary {
            padding: 0.75rem 1.5rem;
            background-color: var(--bg-secondary);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
            border-radius: 0.5rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
        }

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


        /* ========== Dashboard Cards com GridStack ========== */

        .grid-stack {
            background: transparent;
            min-height: 0;
        }

        .grid-stack:empty {
            display: none !important;
            margin: 0 !important;
            height: 0 !important;
        }

        .grid-stack-item {
            border-radius: var(--radius-md);
            overflow: hidden;
            background: transparent;
            border: none;
        }

        .grid-stack-item-content {
            background: transparent;
            border-radius: var(--radius-md);
            box-shadow: none;
            overflow: hidden;
            inset: 0 !important;
            border: none;
        }

        .dashboard-card {
            height: 100%;
            display: flex;
            flex-direction: column;
            outline: none;
        }

        .dashboard-card-header {
            cursor: move;
            padding: 1rem;
            border-bottom: 1px solid #404040;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #2d2d2d;
        }

        .dashboard-card-header h3 {
            margin: 0;
            font-size: 1.125rem;
            font-weight: 600;
            color: #ffffff;
        }

        .card-menu-btn {
            background: none;
            border: none;
            cursor: pointer;
            padding: 0.25rem;
            font-size: 1.25rem;
            color: #9ca3af;
            transition: color 0.2s;
        }

        .card-menu-btn:hover {
            color: #ffffff;
        }

        .card-menu-dropdown {
            position: absolute;
            right: 0;
            top: 100%;
            background: #2d2d2d;
            border: 1px solid #404040;
            border-radius: var(--radius-sm);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
            min-width: 150px;
            z-index: 1000;
            margin-top: 0.25rem;
        }

        .card-menu-dropdown button {
            width: 100%;
            text-align: left;
            padding: 0.5rem 1rem;
            border: none;
            background: none;
            cursor: pointer;
            display: block;
            font-size: 0.875rem;
            color: #e5e7eb;
            transition: background-color 0.15s;
        }

        .card-menu-dropdown button:hover {
            background-color: #404040;
        }

        .card-menu-dropdown button:first-child {
            border-top-left-radius: 0.5rem;
            border-top-right-radius: 0.5rem;
        }

        .card-menu-dropdown button:last-child {
            border-bottom-left-radius: 0.5rem;
            border-bottom-right-radius: 0.5rem;
        }

        /* Metric Cards dentro dos Dashboard Cards */

        .metric-cards-container {
            flex: 1;
            padding: 1rem;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
            overflow-y: auto;
        }

        .metric-card {
            background: #f9fafb;
            border-radius: 0.5rem;
            padding: 1rem;
            border: 1px solid #e5e7eb;
        }

        .metric-name {
            font-size: 0.875rem;
            color: #6b7280;
            margin-bottom: 0.5rem;
            font-weight: 500;
        }

        .metric-value {
            font-size: 1.5rem;
            font-weight: 700;
            color: #111827;
            margin-bottom: 0.25rem;
        }

        .metric-variation {
            font-size: 0.875rem;
            margin-bottom: 0.75rem;
        }

        .metric-variation .text-green-600 {
            color: #10b981;
        }

        .metric-variation .text-red-600 {
            color: #ef4444;
        }

        .period-selector {
            width: 100%;
            padding: 0.5rem;
            border: 1px solid #d1d5db;
            border-radius: var(--radius-sm);
            font-size: 0.875rem;
            background: white;
            color: #374151;
            cursor: pointer;
        }

        .period-selector:focus {
            outline: none;
            border-color: #3b82f6;
            ring: 2px;
            ring-color: rgba(59, 130, 246, 0.5);
        }

        /* Graph Container */

        .graph-container {
            flex: 1;
            padding: 1rem;
            position: relative;
            min-height: 200px;
        }

        .graph-container canvas {
            max-height: 100%;
        }

        /* Modal Styles */

        .modal {
            display: none;
            position: fixed;
            z-index: 9999;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.5);
            align-items: center;
            justify-content: center;
        }

        .modal-content {
            background-color: var(--bg-card);
            margin: auto;
            padding: 0;
            border-radius: 0.5rem;
            width: 90%;
            max-width: 600px;
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
        }

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

        .modal-header h3 {
            margin: 0;
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--text-primary);
        }

        .modal-header .modal-close {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1.5rem;
            padding: 0;
            width: 2rem;
            height: 2rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0.25rem;
            transition: all 0.2s ease;
        }

        .modal-header .modal-close:hover {
            background-color: var(--bg-secondary);
            color: var(--text-primary);
        }

        .modal-body {
            padding: 1.5rem;
        }

        .modal-footer {
            padding: 1.5rem;
            border-top: 1px solid var(--border-color);
            display: flex;
            gap: 0.75rem;
            justify-content: flex-end;
        }

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

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

        .form-control {
            width: 100%;
            padding: 0.5rem 0.75rem;
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            font-size: 0.875rem;
            color: var(--text-primary);
            background-color: var(--bg-secondary);
        }

        .form-control:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 3px rgba(204, 255, 0, 0.1);
        }

        [data-theme="light"] .form-control:focus {
            box-shadow: 0 0 0 3px rgba(136, 204, 0, 0.1);
        }

        /* Empty State */

        #dashboard-empty-state {
            padding: 3rem 1rem;
            text-align: center;
        }

        #dashboard-empty-state i {
            font-size: 4rem;
            color: #9ca3af;
            margin-bottom: 1rem;
        }

        #dashboard-empty-state p {
            color: #6b7280;
            margin-bottom: 0.5rem;
        }

        /* Responsive */

        @media (max-width: 768px) {
            .metric-cards-container {
                grid-template-columns: 1fr;
            }

            .modal-content {
                width: 95%;
                margin: 1rem auto;
            }
        }

        /* GridStack Override */

        .grid-stack>.grid-stack-item>.grid-stack-item-content {
            cursor: default;
        }

        .grid-stack>.grid-stack-item.ui-draggable-dragging>.grid-stack-item-content {
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }

        /* ===== Card Edit Modal Styles ===== */
        #card-edit-modal-overlay.show {
            display: flex !important;
        }

        .card-modal-tab {
            transition: all 0.2s ease;
        }

        .card-modal-tab:hover {
            color: var(--text-primary);
        }

        .card-modal-tab.active {
            color: var(--accent-color);
            border-bottom-color: var(--accent-color) !important;
        }

        /* Icon Selection */
        .icon-option {
            width: 70px;
            height: 70px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid var(--border-color);
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all 0.2s ease;
            background: var(--bg-secondary);
        }

        .icon-option:hover {
            border-color: var(--accent-color);
            background: rgba(204, 255, 0, 0.05);
        }

        .icon-option.selected {
            border-color: var(--accent-color);
            background: rgba(204, 255, 0, 0.1);
        }

        .icon-option i {
            font-size: 2rem;
            color: var(--text-primary);
        }

        /* Color Selection */
        .color-option {
            width: 60px;
            height: 60px;
            border: 2px solid var(--border-color);
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
        }

        .color-option:hover {
            transform: scale(1.1);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        .color-option.selected {
            border-color: var(--text-primary);
            border-width: 3px;
        }

        .color-option.selected::after {
            content: '✓';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: #ffffff;
            font-size: 1.5rem;
            font-weight: bold;
            text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
        }

        /* Period Selection */
        .period-option {
            transition: all 0.2s ease;
        }

        .period-option:hover {
            border-color: var(--accent-color) !important;
            background: rgba(204, 255, 0, 0.05) !important;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(204, 255, 0, 0.2);
            border-radius: var(--radius-md) !important;
        }

        .period-option.selected {
            border-color: var(--accent-color) !important;
            background: rgba(204, 255, 0, 0.1) !important;
            box-shadow: 0 0 0 3px rgba(204, 255, 0, 0.2);
            border-radius: var(--radius-md) !important;
        }

        .period-option.selected i {
            color: var(--accent-color) !important;
        }
        /* =====================================================================
           DRE VIEW STYLES
           ===================================================================== */
        .dre-line {
            padding: 0.75rem 1rem;
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .dre-line:hover {
            background: rgba(204, 255, 0, 0.05);
        }

        .dre-line.selected {
            background: rgba(204, 255, 0, 0.1);
            border-left: 3px solid var(--accent-color);
        }

        /* Main Lines (Bold, dark background) */
        .dre-line.main {
            background: #2d2d2d;
            font-weight: 600;
            border: none;
            margin-top: 0.5rem;
        }

        .dre-line.main:first-child {
            margin-top: 0;
        }

        [data-theme="light"] .dre-line.main {
            background: #e5e7eb;
        }

        /* Result Lines (with equals sign) */
        .dre-line.result {
            background: #1e1e1e;
            font-weight: 600;
            border: none;
            margin-top: 0.25rem;
        }

        [data-theme="light"] .dre-line.result {
            background: #f3f4f6;
        }

        /* Highlighted Line (yellow) */
        .dre-line.highlighted {
            background: #CCFF00;
            color: #000000;
            font-weight: 600;
            border: none;
        }

        .dre-line.highlighted .dre-value {
            color: #000000 !important;
        }

        /* Sub Lines (indented) */
        .dre-line.sub {
            padding-left: 2rem;
            font-size: 0.875rem;
        }

        .dre-line.sub-2 {
            padding-left: 3rem;
            font-size: 0.8125rem;
        }

        /* Expandable indicator */
        .dre-expand-icon {
            margin-right: 0.5rem;
            transition: transform 0.2s ease;
            color: var(--text-secondary);
            font-size: 0.75rem;
        }

        .dre-line.expanded .dre-expand-icon {
            transform: rotate(90deg);
        }

        /* Line Label */
        .dre-label {
            display: flex;
            align-items: center;
            color: var(--text-primary);
        }

        .dre-line.main .dre-label,
        .dre-line.result .dre-label,
        .dre-line.highlighted .dre-label {
            font-size: 0.9375rem;
        }

        /* Line Value */
        .dre-value {
            color: var(--text-primary);
            font-family: 'Courier New', monospace;
            white-space: nowrap;
        }

        /* Details Panel */
        .dre-detail-item {
            padding: 0.75rem;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.875rem;
        }

        .dre-detail-item:last-child {
            border-bottom: none;
        }

        .dre-detail-label {
            color: var(--text-secondary);
        }

        .dre-detail-value {
            color: var(--text-primary);
            font-family: 'Courier New', monospace;
            font-weight: 500;
        }

        /* Empty State */
        .dre-empty-state {
            text-align: center;
            padding: 3rem 1rem;
            color: var(--text-secondary);
        }

        /* Loading State */
        .dre-loading {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 3rem;
            color: var(--text-secondary);
        }

        /* Responsive */
        @media (max-width: 1024px) {
            #dre-view > div > div:nth-child(2) {
                grid-template-columns: 1fr !important;
                height: auto !important;
            }

            .dre-line {
                font-size: 0.8125rem;
            }

            .dre-line.sub {
                padding-left: 1.5rem;
            }

            .dre-line.sub-2 {
                padding-left: 2.5rem;
            }
        }

        /* =====================================================================
           DRE IF FORMULA BUILDER STYLES
           ===================================================================== */

        /* Formula type selector pills */
        .dre-formula-type-pills {
            display: flex;
            gap: 0;
            background: var(--bg-secondary);
            border-radius: 0.625rem;
            padding: 0.25rem;
            border: 2px solid transparent;
        }

        .dre-formula-type-pill {
            display: none;
        }

        .dre-formula-type-pill + label {
            padding: 0.5rem 1.25rem;
            font-size: 0.8125rem;
            color: var(--text-muted);
            cursor: pointer;
            border-radius: 0.5rem;
            transition: all 0.2s;
            font-weight: 600;
            white-space: nowrap;
            text-align: center;
            flex: 1;
        }

        .dre-formula-type-pill:checked + label {
            background: var(--accent-color);
            color: #000;
        }

        /* IF Block */
        .dre-if-block {
            background: #1e1e1e;
            border: 1px solid #404040;
            border-left: 4px solid #F59E0B;
            border-radius: 0.5rem;
            padding: 1rem;
            margin-bottom: 0.5rem;
        }

        [data-theme="light"] .dre-if-block {
            background: #f3f4f6;
            border-color: #d1d5db;
            border-left-color: #F59E0B;
        }

        .dre-if-block .dre-if-block {
            background: #252525;
        }

        [data-theme="light"] .dre-if-block .dre-if-block {
            background: #e5e7eb;
        }

        .dre-if-block .dre-if-block .dre-if-block {
            background: #2a2a2a;
        }

        [data-theme="light"] .dre-if-block .dre-if-block .dre-if-block {
            background: #d1d5db;
        }

        .dre-if-block-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.75rem;
        }

        .dre-if-block-label {
            font-size: 0.8125rem;
            font-weight: 700;
            color: #F59E0B;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .dre-if-block-delete {
            background: none;
            border: none;
            color: #9ca3af;
            cursor: pointer;
            font-size: 1.125rem;
            padding: 0.25rem;
            line-height: 1;
            border-radius: 0.25rem;
            transition: all 0.2s;
        }

        .dre-if-block-delete:hover {
            color: #ef4444;
            background: rgba(239, 68, 68, 0.1);
        }

        /* Condition area */
        .dre-if-condition-area {
            margin-bottom: 0.75rem;
        }

        .dre-condition-row {
            display: flex;
            gap: 0.5rem;
            align-items: center;
            margin-bottom: 0.5rem;
        }

        .dre-condition-row select,
        .dre-condition-row input {
            background: #2d2d2d;
            border: 1px solid #404040;
            border-radius: 0.375rem;
            color: #e5e7eb;
            padding: 0.5rem;
            font-size: 0.8125rem;
        }

        [data-theme="light"] .dre-condition-row select,
        [data-theme="light"] .dre-condition-row input {
            background: #ffffff;
            border-color: #d1d5db;
            color: #1f2937;
        }

        .dre-condition-row .dre-cond-column {
            flex: 2;
            min-width: 0;
        }

        .dre-condition-row .dre-cond-operator {
            flex: 1.2;
            min-width: 0;
        }

        .dre-condition-row .dre-cond-value {
            flex: 1.5;
            min-width: 0;
        }

        .dre-condition-row .dre-cond-remove {
            background: none;
            border: none;
            color: #9ca3af;
            cursor: pointer;
            font-size: 1rem;
            padding: 0.25rem;
            flex-shrink: 0;
            border-radius: 0.25rem;
            transition: all 0.2s;
        }

        .dre-condition-row .dre-cond-remove:hover {
            color: #ef4444;
            background: rgba(239, 68, 68, 0.1);
        }

        /* Condition connector (AND/OR) */
        .dre-condition-connector {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin: 0.25rem 0 0.5rem 0;
            padding-left: 0.5rem;
        }

        .dre-condition-connector label {
            display: flex;
            align-items: center;
            gap: 0.375rem;
            font-size: 0.75rem;
            color: #9ca3af;
            cursor: pointer;
            font-weight: 600;
        }

        .dre-condition-connector input[type="radio"] {
            cursor: pointer;
        }

        /* Add condition button */
        .dre-if-add-condition {
            background: none;
            border: 1px dashed #404040;
            color: #9ca3af;
            padding: 0.375rem 0.75rem;
            border-radius: 0.375rem;
            font-size: 0.75rem;
            cursor: pointer;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
        }

        .dre-if-add-condition:hover {
            border-color: #F59E0B;
            color: #F59E0B;
        }

        /* Result areas (THEN/ELSE) */
        .dre-if-result-area {
            padding: 0.75rem;
            border-radius: 0.375rem;
            margin-bottom: 0.5rem;
            background: rgba(0, 0, 0, 0.15);
        }

        [data-theme="light"] .dre-if-result-area {
            background: rgba(0, 0, 0, 0.04);
        }

        .dre-if-result-area.then {
            border-left: 3px solid #10B981;
        }

        .dre-if-result-area.else {
            border-left: 3px solid #EF4444;
        }

        .dre-if-result-label {
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 0.5rem;
        }

        .dre-if-result-area.then .dre-if-result-label {
            color: #10B981;
        }

        .dre-if-result-area.else .dre-if-result-label {
            color: #EF4444;
        }

        /* Result type pills */
        .dre-result-type-pills {
            display: flex;
            gap: 0.25rem;
            margin-bottom: 0.5rem;
            background: #2d2d2d;
            border-radius: 0.375rem;
            padding: 0.25rem;
        }

        [data-theme="light"] .dre-result-type-pills {
            background: #e5e7eb;
        }

        .dre-result-type-pill {
            display: none;
        }

        .dre-result-type-pill + label {
            padding: 0.375rem 0.75rem;
            font-size: 0.75rem;
            color: #9ca3af;
            cursor: pointer;
            border-radius: 0.25rem;
            transition: all 0.2s;
            font-weight: 500;
            white-space: nowrap;
        }

        .dre-result-type-pill:checked + label {
            background: #404040;
            color: #e5e7eb;
        }

        [data-theme="light"] .dre-result-type-pill:checked + label {
            background: #ffffff;
            color: #1f2937;
        }

        /* Result content */
        .dre-result-content select,
        .dre-result-content input {
            background: #2d2d2d;
            border: 1px solid #404040;
            border-radius: 0.375rem;
            color: #e5e7eb;
            padding: 0.5rem;
            font-size: 0.8125rem;
            width: 100%;
        }

        [data-theme="light"] .dre-result-content select,
        [data-theme="light"] .dre-result-content input {
            background: #ffffff;
            border-color: #d1d5db;
            color: #1f2937;
        }

        /* Formula preview */
        .dre-if-formula-preview-box {
            background: #1a1a1a;
            border: 1px solid #404040;
            border-radius: 0.375rem;
            padding: 1rem;
            font-family: 'JetBrains Mono', 'Fira Code', monospace;
            font-size: 0.8125rem;
            color: #9ca3af;
            white-space: pre-wrap;
            word-break: break-word;
            line-height: 1.6;
            max-height: 200px;
            overflow-y: auto;
            margin: 0;
        }

        [data-theme="light"] .dre-if-formula-preview-box {
            background: #f3f4f6;
            border-color: #d1d5db;
            color: #4b5563;
        }
