:root {
            --app-font-scale: 0.8;
            --primary-color: #6366f1;
            --primary-light: #818cf8;
            --primary-dark: #4f46e5;
            --secondary-color: #8b5cf6;
            --success-color: #10b981;
            --warning-color: #f59e0b;
            --danger-color: #ef4444;
            --info-color: #3b82f6;
            --dark-color: #1f2937;
            --light-bg: #f9fafb;
            --card-bg: #ffffff;
            --border-radius: 16px;
            --border-radius-sm: 12px;
            --border-radius-lg: 20px;
            --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
            --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
            --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
            --sidebar-width: 280px;
            --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        html {
            font-size: calc(100% * var(--app-font-scale));
        }

        * {
            transition: var(--transition);
        }

        body {
            background: linear-gradient(135deg, var(--light-bg) 0%, color-mix(in srgb, var(--primary-color) 12%, var(--light-bg)) 100%);
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            min-height: 100vh;
        }

        h1, h2, h3, h4, h5, h6,
        .navbar-brand,
        .card-header h5 {
            font-weight: 600;
        }

        code, pre, .font-mono {
            font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        }

        .navbar {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            box-shadow: var(--shadow-md);
            backdrop-filter: blur(10px);
            border: none;
            padding: 1rem 0;
            position: relative;
            z-index: 1030;
        }

        .navbar-brand {
            font-weight: 700;
            font-size: 1.5rem;
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .navbar-brand i {
            font-size: 2rem;
            filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
        }

        .btn {
            border-radius: var(--border-radius-sm);
            font-weight: 600;
            padding: 0.625rem 1.5rem;
            border: none;
            box-shadow: var(--shadow-sm);
            transition: var(--transition);
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
        }

        .btn-success {
            background: linear-gradient(135deg, var(--success-color) 0%, #34d399 100%);
        }

        .btn-warning {
            background: linear-gradient(135deg, var(--warning-color) 0%, #fbbf24 100%);
        }

        .btn-danger {
            background: linear-gradient(135deg, var(--danger-color) 0%, #f87171 100%);
        }

        .btn-info {
            background: linear-gradient(135deg, var(--info-color) 0%, #60a5fa 100%);
        }

        .bg-orange {
            background-color: #f97316 !important;
        }

        .btn-outline-light {
            border: 2px solid rgba(255, 255, 255, 0.8);
            background: transparent;
        }

        .btn-outline-light:hover {
            background: rgba(255, 255, 255, 0.2);
            border-color: white;
        }

        .sidebar {
            background: var(--card-bg);
            min-height: calc(100vh - 76px);
            border-radius: 0 var(--border-radius) var(--border-radius) 0;
            padding: 1.5rem 1rem;
            box-shadow: var(--shadow-md);
            position: sticky;
            top: 76px;
            height: calc(100vh - 76px);
            overflow-y: auto;
        }

        @media (min-width: 992px) {
            .sidebar {
                width: var(--sidebar-width, 280px);
                max-width: var(--sidebar-width, 280px);
            }
        }

        @media (max-width: 991px) {
            .sidebar {
                position: fixed;
                left: -320px;
                top: 76px;
                bottom: 0;
                z-index: 1020;
                width: 280px;
                max-width: 85vw;
                min-height: auto;
                height: calc(100vh - 76px);
                overflow-y: auto;
                transition: left 0.3s ease;
                border-radius: 0;
                box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
            }
            body.sidebar-open .sidebar {
                left: 0;
            }
            .sidebar-overlay {
                display: none;
                position: fixed;
                inset: 0;
                background: rgba(0, 0, 0, 0.4);
                z-index: 1019;
                top: 76px;
            }
            body.sidebar-open .sidebar-overlay {
                display: block;
            }
        }

        .sidebar .nav-link {
            color: var(--dark-color);
            padding: 0.875rem 1.25rem;
            border-radius: var(--border-radius-sm);
            margin: 0.375rem 0;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 0.75rem;
            transition: var(--transition);
        }

        .sidebar .nav-link i {
            font-size: 1.25rem;
            width: 24px;
            text-align: center;
        }

        .sidebar .nav-link:hover {
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
            color: var(--primary-color);
            transform: translateX(4px);
        }

        .sidebar-nav-group {
            margin-bottom: 0.25rem;
        }

        .sidebar-nav-group.is-hidden {
            display: none;
        }

        .sidebar-nav-label {
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--text-muted, #94a3b8);
            padding: 0.75rem 1.25rem 0.25rem;
            margin-top: 0.25rem;
            line-height: 1.3;
        }

        .sidebar-nav-group:first-child .sidebar-nav-label {
            margin-top: 0;
            padding-top: 0.25rem;
        }

        .sidebar .nav-link.active {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
            box-shadow: var(--shadow-sm);
        }

        .card {
            border: none;
            border-radius: var(--border-radius);
            box-shadow: var(--shadow-md);
            overflow: hidden;
            background: var(--card-bg);
        }

        .card-header {
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
            border-bottom: 2px solid rgba(99, 102, 241, 0.1);
            padding: 1.25rem 1.5rem;
            font-weight: 600;
        }

        .stat-card {
            border: none;
            border-radius: var(--border-radius);
            transition: var(--transition);
            overflow: hidden;
            position: relative;
        }

        .stat-card::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            background: linear-gradient(180deg, var(--accent-color) 0%, transparent 100%);
        }

        .stat-card:hover {
            transform: translateY(-8px);
            box-shadow: var(--shadow-lg);
        }

        .stat-card.primary {
            --accent-color: var(--primary-color);
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
        }

        .stat-card.success {
            --accent-color: var(--success-color);
            background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
        }

        .stat-card.warning {
            --accent-color: var(--warning-color);
            background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
        }

        .stat-card.danger {
            --accent-color: var(--danger-color);
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
        }

        .stat-card.info {
            --accent-color: var(--info-color);
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
        }

        .stat-card .card-body {
            padding: 1.5rem;
        }

        .stat-card h6 {
            color: #6b7280;
            font-size: 0.875rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 0.5rem;
        }

        .stat-card h2, .stat-card h3 {
            color: var(--dark-color);
            font-weight: 700;
            margin-bottom: 0.25rem;
        }

        .stat-card small {
            color: #9ca3af;
            font-size: 0.875rem;
        }

        .badge {
            border-radius: var(--border-radius-sm);
            padding: 0.5rem 1rem;
            font-weight: 600;
            font-size: 0.875rem;
        }

        .badge-priority {
            padding: 0.375rem 0.875rem;
            font-size: 0.75rem;
        }

        .table {
            border-radius: var(--border-radius);
            overflow: hidden;
        }

        .table thead {
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
        }

        .table thead th {
            border: none;
            color: var(--dark-color);
            font-weight: 700;
            padding: 1rem 1.5rem;
            text-transform: uppercase;
            font-size: 0.75rem;
            letter-spacing: 0.05em;
        }

        .table tbody tr {
            transition: var(--transition);
        }

        .table tbody tr:hover {
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(139, 92, 246, 0.03) 100%);
            transform: scale(1.01);
        }

        .table tbody td {
            padding: 1rem 1.5rem;
            vertical-align: middle;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        }

        .form-control, .form-select {
            border-radius: var(--border-radius-sm);
            border: 2px solid #e5e7eb;
            padding: 0.75rem 1rem;
            transition: var(--transition);
        }

        .form-control:focus, .form-select:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
        }

        .form-label {
            font-weight: 600;
            color: var(--dark-color);
            margin-bottom: 0.5rem;
        }

        .modal-content {
            border: none;
            border-radius: var(--border-radius-lg);
            box-shadow: var(--shadow-lg);
        }

        .modal-header {
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
            border-bottom: 2px solid rgba(99, 102, 241, 0.1);
            border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
            padding: 1.5rem;
        }

        .modal-title {
            font-weight: 700;
            color: var(--dark-color);
        }

        .modal-footer {
            border-top: 2px solid rgba(0, 0, 0, 0.05);
            padding: 1.25rem 1.5rem;
        }

        .alert {
            border: none;
            border-radius: var(--border-radius);
            padding: 1rem 1.25rem;
            box-shadow: var(--shadow-sm);
        }

        .alert-info {
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
            color: var(--info-color);
            border-left: 4px solid var(--info-color);
        }

        .alert-danger {
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
            color: var(--danger-color);
            border-left: 4px solid var(--danger-color);
        }

        .nav-tabs {
            border: none;
            gap: 0.5rem;
        }

        .nav-tabs .nav-link {
            border: none;
            border-radius: var(--border-radius-sm);
            color: #6b7280;
            font-weight: 600;
            padding: 0.75rem 1.5rem;
        }

        .nav-tabs .nav-link:hover {
            background: rgba(99, 102, 241, 0.1);
            color: var(--primary-color);
        }

        .nav-tabs .nav-link.active {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
            box-shadow: var(--shadow-sm);
        }

        .list-group-item {
            border: none;
            border-radius: var(--border-radius-sm);
            margin-bottom: 0.5rem;
            box-shadow: var(--shadow-sm);
            transition: var(--transition);
        }

        .list-group-item:hover {
            transform: translateX(4px);
            box-shadow: var(--shadow-md);
        }

        .input-group-text {
            border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
            border: 2px solid #e5e7eb;
            border-right: none;
            background: #f9fafb;
        }

        .input-group .form-control {
            border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
            border-left: none;
        }

        .item-card {
            transition: var(--transition);
        }

        .item-card:hover {
            box-shadow: var(--shadow-lg);
        }

        h2, h5, h6 {
            color: var(--dark-color);
            font-weight: 700;
        }

        small.text-muted {
            color: #9ca3af !important;
        }

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

        .card, .stat-card {
            animation: fadeInUp 0.5s ease-out;
        }

        /* Gradientes sólidos só em fundos “cheios”; não sobrescrever bg-opacity-* */
        .bg-primary:not([class*="bg-opacity"]) {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%) !important;
        }

        .bg-success:not([class*="bg-opacity"]) {
            background: linear-gradient(135deg, var(--success-color) 0%, #34d399 100%) !important;
        }

        .bg-warning:not([class*="bg-opacity"]) {
            background: linear-gradient(135deg, var(--warning-color) 0%, #fbbf24 100%) !important;
        }

        .bg-info:not([class*="bg-opacity"]) {
            background: linear-gradient(135deg, var(--info-color) 0%, #60a5fa 100%) !important;
        }

        .bg-danger:not([class*="bg-opacity"]) {
            background: linear-gradient(135deg, var(--danger-color) 0%, #f87171 100%) !important;
        }

        /* Resumo financeiro — contraste alto em tema claro/escuro */
        .finance-summary-card {
            border-radius: 0.5rem;
            padding: 1rem;
            height: 100%;
            color: #fff !important;
            border: 1px solid transparent;
        }
        .finance-summary-card .finance-summary-label,
        .finance-summary-card .finance-summary-sub {
            color: rgba(255, 255, 255, 0.95) !important;
            font-weight: 600;
        }
        .finance-summary-card .finance-summary-value {
            color: #fff !important;
            font-weight: 700;
        }
        .finance-summary-card--low {
            background: linear-gradient(135deg, #047857 0%, #059669 100%) !important;
            border-color: #10b981;
        }
        .finance-summary-card--high {
            background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%) !important;
            border-color: #f87171;
        }
        .finance-summary-card--savings {
            background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%) !important;
            border-color: #38bdf8;
        }

        .text-white {
            color: white !important;
        }

        .form-check-input:checked {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
        }

        .form-control-color {
            border-radius: var(--border-radius-sm);
            height: 45px;
            border: 2px solid #e5e7eb;
        }

        #user-info {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            background: transparent;
            padding: 0;
            border-radius: 0;
            backdrop-filter: none;
            color: inherit;
        }

        .user-navbar-avatar,
        .user-navbar-avatar-fallback {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            object-fit: cover;
            flex-shrink: 0;
        }

        .user-navbar-avatar-fallback {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #6366f1, #8b5cf6);
            color: #fff;
            font-size: 0.7rem;
            font-weight: 700;
        }

        .user-navbar-name {
            max-width: 140px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        #userMenuBtn {
            border-color: rgba(255, 255, 255, 0.35);
        }

        .table-responsive {
            border-radius: var(--border-radius);
            overflow-x: auto;
            overflow-y: visible;
            -webkit-overflow-scrolling: touch;
        }

        .notification-dropdown {
            width: 350px;
            max-height: 450px;
            overflow-y: auto;
            position: absolute;
            top: 100% !important;
            right: 0 !important;
            left: auto !important;
            margin-top: 0.5rem;
            z-index: 9999;
            box-shadow: var(--shadow-lg);
            border-radius: var(--border-radius);
        }

        .notification-item {
            padding: 12px;
            border-bottom: 1px solid #dee2e6;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .notification-item:hover {
            background-color: #f8f9fa;
        }

        .notification-item.unread {
            background-color: #e7f3ff;
        }

        .notification-item.unread:hover {
            background-color: #d0e7ff;
        }

        .notification-item p {
            font-size: 0.9rem;
            color: #495057;
        }

        .dropdown-header {
            position: sticky;
            top: 0;
            background: white;
            z-index: 1;
            border-bottom: 1px solid #dee2e6;
        }

        #notifications-list {
            max-height: 350px;
            overflow-y: auto;
        }

        .timeline {
            position: relative;
            padding: 20px 0;
        }

        .timeline::before {
            content: '';
            position: absolute;
            left: 20px;
            top: 0;
            bottom: 0;
            width: 2px;
            background: #dee2e6;
        }

        .timeline-item {
            position: relative;
            padding-left: 50px;
            margin-bottom: 20px;
        }

        .timeline-marker {
            position: absolute;
            left: 0;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .timeline-content {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 12px;
        }

        /* Toasts Modernos */
        .custom-toast {
            min-width: 320px;
            max-width: 420px;
            background: white;
            border-radius: 16px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
            border: none;
            overflow: hidden;
            animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        }

        @keyframes slideInRight {
            from {
                transform: translateX(100%);
                opacity: 0;
            }
            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        @keyframes slideOutRight {
            from {
                transform: translateX(0);
                opacity: 1;
            }
            to {
                transform: translateX(100%);
                opacity: 0;
            }
        }

        .custom-toast.hiding {
            animation: slideOutRight 0.3s ease-in forwards;
        }

        .custom-toast .toast-header {
            background: transparent;
            border-bottom: none;
            padding: 1rem 1rem 0.5rem 1rem;
        }

        .custom-toast .toast-body {
            padding: 0.5rem 1rem 1rem 1rem;
            font-size: 0.95rem;
            color: #374151;
        }

        .custom-toast .toast-icon {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.25rem;
            margin-right: 12px;
        }

        .custom-toast.toast-success .toast-icon {
            background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
            color: white;
        }

        .custom-toast.toast-error .toast-icon {
            background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
            color: white;
        }

        .custom-toast.toast-warning .toast-icon {
            background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
            color: white;
        }

        .custom-toast.toast-info .toast-icon {
            background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
            color: white;
        }

        .custom-toast .toast-title {
            font-weight: 700;
            font-size: 1rem;
            color: #1f2937;
            margin: 0;
        }

        .custom-toast .btn-close {
            opacity: 0.5;
            transition: opacity 0.2s ease;
        }

        .custom-toast .btn-close:hover {
            opacity: 1;
        }

        .custom-toast .toast-progress {
            height: 4px;
            background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            border-radius: 0 0 16px 16px;
            animation: progressShrink 5s linear forwards;
        }

        @keyframes progressShrink {
            from { width: 100%; }
            to { width: 0%; }
        }

        /* Marca d'água */
        .watermark {
            position: fixed;
            bottom: 20px;
            right: 20px;
            font-size: 0.75rem;
            color: #6b7280;
            opacity: 0.75;
            z-index: 999;
            pointer-events: none;
            user-select: none;
            font-weight: 500;
            text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
            background: rgba(255, 255, 255, 0.5);
            padding: 0.375rem 0.75rem;
            border-radius: 6px;
            backdrop-filter: blur(4px);
            transition: opacity 0.3s ease;
        }

        .watermark.hidden {
            opacity: 0;
            visibility: hidden;
        }

        @media (max-width: 768px) {
            .watermark {
                font-size: 0.65rem;
                bottom: 10px;
                right: 10px;
                padding: 0.25rem 0.5rem;
            }
        }

        @media print {
            .watermark {
                display: none;
            }
        }

        /* Responsividade adicional */
        @media (max-width: 576px) {
            .btn-group-vertical.btn-group-sm .btn {
                font-size: 0.75rem;
                padding: 0.25rem 0.5rem;
            }

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

            .table-sm td, .table-sm th {
                padding: 0.5rem;
                font-size: 0.875rem;
            }

            .badge {
                font-size: 0.7rem;
                padding: 0.25rem 0.5rem;
            }

            h2 {
                font-size: 1.5rem;
            }

            .stat-card h3 {
                font-size: 1.5rem;
            }
        }

        @media (max-width: 768px) {
            .navbar-brand {
                font-size: 1.1rem;
            }

            #user-info {
                font-size: 0.8rem;
                padding: 0.35rem 0.5rem;
            }

            #dashboard-content,
            [id$="-content"] {
                padding: 0.75rem !important;
                overflow-x: hidden;
            }
        }

        @media (max-width: 576px) {
            .navbar .dropdown-menu {
                min-width: 280px;
                max-width: calc(100vw - 2rem);
            }
        }

        .bg-gradient-primary {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
        }

        .bg-gradient-success {
            background: linear-gradient(135deg, var(--success-color) 0%, #34d399 100%);
        }

        .bg-gradient-info {
            background: linear-gradient(135deg, var(--info-color) 0%, #60a5fa 100%);
        }

        .supplier-card {
            border-left: 4px solid var(--success-color);
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .supplier-card:hover {
            transform: translateX(4px);
            box-shadow: var(--shadow-md);
            background: rgba(16, 185, 129, 0.05);
        }

        .supplier-card.selected {
            background: rgba(16, 185, 129, 0.1);
            border-left-color: var(--primary-color);
        }

        .theme-option-card.active {
            border-width: 2px;
            border-color: var(--primary-color) !important;
            background: color-mix(in srgb, var(--primary-color) 8%, white);
        }

        html[data-theme="dark"] .theme-option-card.active,
        body[data-theme="dark"] .theme-option-card.active {
            background: color-mix(in srgb, var(--primary-color) 20%, #1e293b);
        }

        /* Tema escuro (persistido via layout_settings.theme_mode) */
        html[data-theme="dark"] body,
        body[data-theme="dark"] {
            background-color: #121218 !important;
            color: #e4e4e7;
        }
        html[data-theme="dark"] .navbar.navbar-dark,
        body[data-theme="dark"] .navbar.navbar-dark {
            background-color: #18181f !important;
            border-bottom: 1px solid #27272f;
        }
        html[data-theme="dark"] .sidebar,
        body[data-theme="dark"] .sidebar {
            background: #18181f !important;
            border-right: 1px solid #27272f;
        }
        html[data-theme="dark"] .sidebar .nav-link,
        body[data-theme="dark"] .sidebar .nav-link {
            color: #cbd5e1 !important;
        }
        html[data-theme="dark"] .sidebar .nav-link.active,
        body[data-theme="dark"] .sidebar .nav-link.active {
            background: rgba(99, 102, 241, 0.25) !important;
            color: #fff !important;
        }
        html[data-theme="dark"] .card,
        body[data-theme="dark"] .card {
            background-color: #1e1e26;
            border-color: #27272f;
            color: #e4e4e7;
        }
        html[data-theme="dark"] .card-header,
        body[data-theme="dark"] .card-header {
            border-bottom-color: #27272f;
        }
        html[data-theme="dark"] .table,
        body[data-theme="dark"] .table {
            color: #e4e4e7;
            --bs-table-bg: transparent;
        }
        html[data-theme="dark"] .table thead.bg-light,
        body[data-theme="dark"] .table thead.bg-light {
            background-color: #27272f !important;
            color: #f4f4f5;
        }
        html[data-theme="dark"] .form-control,
        html[data-theme="dark"] .form-select,
        body[data-theme="dark"] .form-control,
        body[data-theme="dark"] .form-select {
            background-color: #27272f;
            border-color: #3f3f46;
            color: #f4f4f5;
        }
        html[data-theme="dark"] .text-muted,
        body[data-theme="dark"] .text-muted {
            color: #a1a1aa !important;
        }
        html[data-theme="dark"] .alert-primary,
        body[data-theme="dark"] .alert-primary {
            background-color: rgba(99, 102, 241, 0.15);
            border-color: rgba(99, 102, 241, 0.35);
            color: #e0e7ff;
        }

        /* Preset Intelfoz — modo claro */
        html[data-theme="light"][data-theme-preset="intelfoz"] body {
            background: linear-gradient(135deg, var(--light-bg) 0%, #E2E8F0 100%);
        }

        html[data-theme="light"][data-theme-preset="intelfoz"] .card {
            box-shadow: var(--shadow-sm);
            border-radius: var(--border-radius);
        }

        html[data-theme="light"][data-theme-preset="intelfoz"] .btn:disabled,
        html[data-theme="light"][data-theme-preset="intelfoz"] .btn.disabled {
            opacity: 0.55;
            transform: none;
            box-shadow: none;
        }

        /* Preset Intelfoz — dark mode */
        html[data-theme="dark"][data-theme-preset="intelfoz"] body,
        html[data-theme-preset="intelfoz"] body[data-theme="dark"] {
            background-color: #0F172A !important;
            background-image: none !important;
            color: #F1F5F9;
        }
        html[data-theme="dark"][data-theme-preset="intelfoz"] .navbar.navbar-dark,
        html[data-theme-preset="intelfoz"] body[data-theme="dark"] .navbar.navbar-dark {
            background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
            border-bottom: 1px solid #334155;
        }
        html[data-theme="dark"][data-theme-preset="intelfoz"] .sidebar,
        html[data-theme-preset="intelfoz"] body[data-theme="dark"] .sidebar {
            background: #1E293B !important;
            border-right: 1px solid #334155;
        }
        html[data-theme="dark"][data-theme-preset="intelfoz"] .sidebar .nav-link.active,
        html[data-theme-preset="intelfoz"] body[data-theme="dark"] .sidebar .nav-link.active {
            background: rgba(30, 64, 175, 0.35) !important;
            color: #F8FAFC !important;
        }
        html[data-theme="dark"][data-theme-preset="intelfoz"] .card,
        html[data-theme-preset="intelfoz"] body[data-theme="dark"] .card {
            background-color: #1E293B;
            border-color: #334155;
            color: #F1F5F9;
        }
        html[data-theme="dark"][data-theme-preset="intelfoz"] .table thead.bg-light,
        html[data-theme-preset="intelfoz"] body[data-theme="dark"] .table thead.bg-light {
            background-color: #334155 !important;
            color: #F8FAFC;
        }
        html[data-theme="dark"][data-theme-preset="intelfoz"] .form-control,
        html[data-theme="dark"][data-theme-preset="intelfoz"] .form-select,
        html[data-theme-preset="intelfoz"] body[data-theme="dark"] .form-control,
        html[data-theme-preset="intelfoz"] body[data-theme="dark"] .form-select {
            background-color: #334155;
            border-color: #475569;
            color: #F8FAFC;
        }
        html[data-theme="dark"][data-theme-preset="intelfoz"] .alert-primary,
        html[data-theme-preset="intelfoz"] body[data-theme="dark"] .alert-primary {
            background-color: rgba(30, 64, 175, 0.2);
            border-color: rgba(59, 130, 246, 0.35);
            color: #DBEAFE;
        }

/* ===========================
   Novidades do sistema (release notes)
   =========================== */
body.release-notes-open {
    overflow: hidden;
}

.release-notes-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.release-notes-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.release-notes-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.release-notes-panel {
    position: relative;
    width: min(640px, 100%);
    max-height: min(88vh, 820px);
    display: flex;
    flex-direction: column;
    background: var(--card-bg, #fff);
    border-radius: var(--border-radius-lg, 20px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.release-notes-overlay.is-visible .release-notes-panel {
    transform: translateY(0) scale(1);
}

.release-notes-panel__glow {
    position: absolute;
    top: -40%;
    right: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, color-mix(in srgb, var(--primary-color) 35%, transparent) 0%, transparent 70%);
    pointer-events: none;
}

.release-notes-header {
    position: relative;
    padding: 1.75rem 1.75rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
}

.release-notes-header__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 0.85rem;
}

.release-notes-header__title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.release-notes-header__subtitle {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.92;
    line-height: 1.5;
}

.release-notes-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.release-notes-card {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: var(--border-radius-sm, 12px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: var(--light-bg, #f9fafb);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.release-notes-card:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.release-notes-card__icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.release-notes-card--primary .release-notes-card__icon {
    background: color-mix(in srgb, var(--primary-color) 15%, white);
    color: var(--primary-color);
}

.release-notes-card--success .release-notes-card__icon {
    background: color-mix(in srgb, var(--success-color) 15%, white);
    color: var(--success-color);
}

.release-notes-card--warning .release-notes-card__icon {
    background: color-mix(in srgb, var(--warning-color) 15%, white);
    color: var(--warning-color);
}

.release-notes-card--info .release-notes-card__icon {
    background: color-mix(in srgb, var(--info-color) 15%, white);
    color: var(--info-color);
}

.release-notes-card--secondary .release-notes-card__icon {
    background: color-mix(in srgb, var(--secondary-color) 15%, white);
    color: var(--secondary-color);
}

.release-notes-card__body {
    min-width: 0;
}

.release-notes-card__meta {
    margin-bottom: 0.25rem;
}

.release-notes-card__date {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.release-notes-card__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color, #1f2937);
}

.release-notes-card__summary {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.5;
}

.release-notes-card__highlights {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.45;
}

.release-notes-card__highlights li + li {
    margin-top: 0.2rem;
}

.release-notes-footer {
    padding: 1rem 1.5rem 1.35rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: stretch;
}

.release-notes-footer__hint {
    margin: 0;
    font-size: 0.8rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.release-notes-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--primary-color) 40%, transparent);
    cursor: pointer;
}

.release-notes-btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

html[data-theme="dark"] .release-notes-panel {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .release-notes-card {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .release-notes-card__title {
    color: #f1f5f9;
}

html[data-theme="dark"] .release-notes-card__summary,
html[data-theme="dark"] .release-notes-card__highlights {
    color: #94a3b8;
}

html[data-theme="dark"] .release-notes-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 576px) {
    .release-notes-header {
        padding: 1.35rem 1.25rem 1rem;
    }

    .release-notes-header__title {
        font-size: 1.25rem;
    }

    .release-notes-body {
        padding: 1rem;
    }

    .release-notes-card {
        flex-direction: column;
        gap: 0.65rem;
    }
}

/* ===========================
   Fornecedores — visualização compacta (-30%)
   =========================== */
.suppliers-compact-view {
    font-size: 70%;
}

.suppliers-compact-view .card-header h5 {
    font-size: 1.05em;
}

.suppliers-table-scroll {
    max-height: min(72vh, 820px);
    overflow: auto;
}

.suppliers-data-table {
    --bs-table-cell-padding-y: 0.35rem;
    --bs-table-cell-padding-x: 0.5rem;
    margin-bottom: 0;
}

.suppliers-data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    font-size: 0.95em;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.suppliers-data-table tbody td {
    vertical-align: middle;
}

.suppliers-col-id {
    width: 3.25rem;
    white-space: nowrap;
}

.suppliers-col-name {
    min-width: 10rem;
    max-width: 18rem;
}

.suppliers-col-cnpj {
    width: 9.5rem;
    white-space: nowrap;
}

.suppliers-col-contact {
    min-width: 7rem;
    max-width: 14rem;
}

.suppliers-col-products {
    width: 4.5rem;
}

.suppliers-col-status {
    width: 4.5rem;
}

.suppliers-col-actions {
    width: 5.5rem;
}

.suppliers-cell-name {
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 18rem;
}

.suppliers-cell-cnpj {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.92em;
    white-space: nowrap;
}

.suppliers-contact-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    line-height: 1.25;
}

.suppliers-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suppliers-contact-item i {
    opacity: 0.75;
    font-size: 0.9em;
}

.suppliers-actions {
    display: inline-flex;
    gap: 0.25rem;
    justify-content: center;
}

.suppliers-actions .btn {
    padding: 0.2rem 0.4rem;
    line-height: 1;
}

.suppliers-data-table .badge {
    font-size: 0.85em;
    font-weight: 600;
}

html[data-theme="dark"] .suppliers-data-table thead th {
    background: #1e293b !important;
}

/* Busca de produtos — complemento gestor (nível 2) */
.level2-product-search-highlight {
    padding: 1rem 1.1rem;
    border: 2px solid #ffc107;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.12) 0%, rgba(255, 193, 7, 0.04) 100%);
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.15), 0 4px 12px rgba(255, 193, 7, 0.08);
}

.level2-product-search-label {
    font-weight: 600;
    color: #b45309;
    margin-bottom: 0.5rem;
}

.level2-product-search-input {
    border-width: 2px;
    border-color: #ffc107;
    font-weight: 500;
}

.level2-product-search-input:focus {
    border-color: #e0a800;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.35);
}

.level2-product-search-note {
    margin: 0.75rem 0 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #92400e;
    background: rgba(255, 193, 7, 0.18);
    border-left: 3px solid #ffc107;
    border-radius: 0.25rem;
}

.level2-product-search-wrap {
    position: relative;
}

.level2-product-search-results {
    top: 100%;
    left: 0;
    z-index: 1050;
    max-height: 240px;
    overflow-y: auto;
    margin-top: 2px;
}

.level2-item-price-display,
.level2-item-line-total {
    cursor: default;
    user-select: none;
}

.level2-items-total-summary .level2-items-total-value {
    font-size: 1.05rem;
}

html[data-theme="dark"] .level2-item-line-total,
body[data-theme="dark"] .level2-item-line-total {
    background-color: #27272f !important;
    border-color: #3f3f46;
    color: #f4f4f5;
}

html[data-theme="dark"] .level2-items-total-summary .bg-light,
body[data-theme="dark"] .level2-items-total-summary .bg-light {
    background-color: #27272f !important;
    border-color: #3f3f46 !important;
    color: #f4f4f5;
}

html[data-theme="dark"] .level2-product-search-results .list-group-item,
body[data-theme="dark"] .level2-product-search-results .list-group-item {
    background-color: #27272f;
    border-color: #3f3f46;
    color: #f4f4f5;
}

html[data-theme="dark"] .level2-product-search-results .list-group-item-action:hover,
body[data-theme="dark"] .level2-product-search-results .list-group-item-action:hover {
    background-color: #3f3f46;
    color: #f4f4f5;
}

html[data-theme="dark"] .level2-item-price-display,
body[data-theme="dark"] .level2-item-price-display {
    background-color: #27272f !important;
    border-color: #3f3f46;
    color: #f4f4f5;
}

html[data-theme="dark"] .level2-product-search-highlight,
body[data-theme="dark"] .level2-product-search-highlight {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.14) 0%, rgba(255, 193, 7, 0.05) 100%);
    border-color: #fbbf24;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2), 0 4px 16px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .level2-product-search-label,
body[data-theme="dark"] .level2-product-search-label {
    color: #fcd34d;
}

html[data-theme="dark"] .level2-product-search-input,
body[data-theme="dark"] .level2-product-search-input {
    border-color: #fbbf24;
    background-color: #27272f;
    color: #f4f4f5;
}

html[data-theme="dark"] .level2-product-search-input:focus,
body[data-theme="dark"] .level2-product-search-input:focus {
    border-color: #fcd34d;
    box-shadow: 0 0 0 0.2rem rgba(251, 191, 36, 0.25);
}

html[data-theme="dark"] .level2-product-search-note,
body[data-theme="dark"] .level2-product-search-note {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.12);
    border-left-color: #fbbf24;
}

/* Busca de fornecedores e produtos — destaque visual compartilhado */
.entity-search-highlight {
    padding: 0.75rem 0.9rem;
    border: 2px solid #ffc107;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.12) 0%, rgba(255, 193, 7, 0.04) 100%);
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.15), 0 4px 12px rgba(255, 193, 7, 0.08);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.entity-search-highlight.is-searching {
    border-color: #e0a800;
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.25), 0 0 0 0.2rem rgba(255, 193, 7, 0.2), 0 4px 16px rgba(255, 193, 7, 0.12);
}

.entity-search-label {
    font-weight: 600;
    color: #b45309;
    margin-bottom: 0.5rem;
}

.entity-search-input {
    border-width: 2px;
    border-color: #ffc107;
    font-weight: 500;
}

.entity-search-input:focus {
    border-color: #e0a800;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.35);
}

.entity-search-note {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #92400e;
    background: rgba(255, 193, 7, 0.18);
    border-left: 3px solid #ffc107;
    border-radius: 0.25rem;
    padding: 0.35rem 0.6rem;
    margin-top: 0.5rem;
}

.entity-search-results {
    margin-top: 2px;
}

.entity-search-results .list-group-item {
    border-color: rgba(255, 193, 7, 0.25);
}

html[data-theme="dark"] .entity-search-highlight,
body[data-theme="dark"] .entity-search-highlight {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.14) 0%, rgba(255, 193, 7, 0.05) 100%);
    border-color: #fbbf24;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2), 0 4px 16px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .entity-search-highlight.is-searching,
body[data-theme="dark"] .entity-search-highlight.is-searching {
    border-color: #fcd34d;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3), 0 0 0 0.2rem rgba(251, 191, 36, 0.18), 0 4px 20px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .entity-search-label,
body[data-theme="dark"] .entity-search-label {
    color: #fcd34d;
}

html[data-theme="dark"] .entity-search-input,
body[data-theme="dark"] .entity-search-input {
    border-color: #fbbf24;
    background-color: #27272f;
    color: #f4f4f5;
}

html[data-theme="dark"] .entity-search-input:focus,
body[data-theme="dark"] .entity-search-input:focus {
    border-color: #fcd34d;
    box-shadow: 0 0 0 0.2rem rgba(251, 191, 36, 0.25);
}

html[data-theme="dark"] .entity-search-note,
body[data-theme="dark"] .entity-search-note {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.12);
    border-left-color: #fbbf24;
}

html[data-theme="dark"] .entity-search-results .list-group-item,
body[data-theme="dark"] .entity-search-results .list-group-item {
    background-color: #27272f;
    border-color: #3f3f46;
    color: #f4f4f5;
}

html[data-theme="dark"] .entity-search-results .list-group-item-action:hover,
body[data-theme="dark"] .entity-search-results .list-group-item-action:hover {
    background-color: #3f3f46;
    color: #f4f4f5;
}

.quotation-generic-amount {
    cursor: not-allowed;
    opacity: 0.85;
}

html[data-theme="dark"] .quotation-generic-amount,
body[data-theme="dark"] .quotation-generic-amount {
    background-color: #27272f !important;
    border-color: #3f3f46;
    color: #a1a1aa !important;
}

.quotation-generic-row {
    border-style: dashed !important;
}

.level2-items-list .level2-item-card + .level2-item-card {
    margin-top: 0.5rem;
}

/* Cotação: múltiplos produtos — dropdown visível em todas as linhas */
#quotation-product-rows,
.quotation-product-row,
.product-search-picker {
    overflow: visible !important;
}

.product-search-picker.is-active {
    position: relative;
    z-index: 30;
}

.product-search-picker .product-search-results {
    z-index: 1200 !important;
    background: var(--bs-body-bg, #fff);
    border: 1px solid rgba(255, 193, 7, 0.45);
    max-height: 240px;
    overflow-y: auto;
}

body > .product-search-results.entity-search-results {
    z-index: 2000 !important;
    background: var(--bs-body-bg, #fff);
    border: 1px solid rgba(255, 193, 7, 0.45);
    max-height: 240px;
    overflow-y: auto;
    border-radius: 0.375rem;
}

#quotationModal .modal-body {
    overflow-x: hidden;
}