/* PALETA PREMIUM (IGUAL GESTÃO) */
        :root {
            --primary: #0f172a;
            --primary-light: #334155;
            --accent: #2563eb;
            --bg-body: #f8fafc;
            --bg-sidebar: #ffffff;
            --text-main: #1e293b;
            --text-muted: #64748b;
            --success: #059669;
            --success-bg: #ecfdf5;
            --warning: #d97706;
            --warning-bg: #fffbeb;
            --danger: #e11d48;
            --danger-bg: #fef2f2;
            --border: #e2e8f0;
            --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
            --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
            --shadow-dropdown: 0 10px 30px rgba(0, 0, 0, 0.1);
            --radius: 16px;
        }

        * {
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
            background: var(--bg-body);
            margin: 0;
            padding: 0;
            color: var(--text-main);
            height: 100vh;
            overflow: hidden;
            display: flex;
        }

        /* OVERLAYS E LOGIN */
        #login-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(255,255,255,0.95);
            backdrop-filter: blur(5px);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 9999;
        }

        .login-box {
            background: white;
            padding: 40px;
            border-radius: 24px;
            box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
            width: 90%;
            max-width: 400px;
            text-align: center;
            border: 1px solid var(--border);
            display: none; /* Escondido enquanto conecta */
            animation: fadeIn 0.4s ease-out;
        }

        #loading-msg {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 20px;
            color: var(--primary);
            font-weight: 700;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% { opacity: 0.6; }
            50% { opacity: 1; }
            100% { opacity: 0.6; }
        }

        @keyframes rotate {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        .login-input {
            width: 100%;
            padding: 16px 20px;
            margin-bottom: 15px;
            border: 2px solid var(--border);
            border-radius: 12px;
            font-size: 15px;
            font-weight: 600;
            box-sizing: border-box;
            outline: 0;
            transition: all 0.2s;
            background: #f8fafc;
        }

            .login-input:focus {
                border-color: var(--accent);
                background: white;
                box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
            }

        #app-content {
            display: none;
            width: 100%;
            height: 100%;
        }

        .admin-wrapper {
            display: flex;
            width: 100%;
            height: 100%;
            position: relative;
        }

        /* SIDEBAR PREMIUM */
        .sidebar {
            width: 280px;
            background: var(--bg-sidebar);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            padding: 35px 20px;
            flex-shrink: 0;
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 100;
        }

        .brand {
            font-size: 28px;
            font-weight: 900;
            color: var(--primary);
            margin-bottom: 50px;
            text-align: center;
            letter-spacing: -1px;
            display: block;
            width: 100%;
        }

        .menu-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .menu-item {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 16px 18px;
            border-radius: 14px;
            cursor: pointer;
            color: var(--text-muted);
            font-weight: 700;
            transition: all 0.2s ease;
            text-decoration: none;
            font-size: 15px;
        }

            .menu-item:hover {
                background: var(--bg-body);
                color: var(--primary);
            }

            .menu-item.active {
                background: var(--primary);
                color: white;
                box-shadow: 0 6px 15px rgba(15, 23, 42, 0.2);
            }

            .menu-item .material-icons-round {
                font-size: 22px;
                transition: 0.2s;
            }

            .menu-item.active .material-icons-round {
                color: white;
            }

            .menu-item.external-link {
                background: #f8fafc;
                border: 1px dashed var(--border);
                justify-content: space-between;
                margin-top: 5px;
            }

                .menu-item.external-link:hover {
                    border-color: var(--accent);
                    background: #eff6ff;
                }

                .menu-item.external-link .external-icon {
                    font-size: 18px;
                    color: #94a3b8;
                }

        .user-profile {
            padding: 15px;
            background: #f8fafc;
            border-radius: 12px;
            margin-top: 15px;
            border: 1px solid var(--border);
        }

        .sidebar-footer {
            margin-top: auto;
            border-top: 1px solid var(--border);
            padding-top: 20px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .user-info-flex {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 12px;
        }

        .user-avatar {
            width: 36px;
            height: 36px;
            background: var(--primary);
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 900;
            font-size: 14px;
            flex-shrink: 0;
        }

        .user-details {
            overflow: hidden;
        }

        .user-name {
            font-size: 13px;
            font-weight: 800;
            color: var(--primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .user-email {
            font-size: 11px;
            color: var(--text-muted);
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .btn-logout-custom {
            width: 100%;
            justify-content: center;
            background: #fee2e2;
            color: #b91c1c;
            border: none;
            padding: 10px;
            border-radius: 10px;
            font-weight: 700;
            font-size: 13px;
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            transition: 0.2s;
        }

        .btn-logout-custom:hover {
            background: #fecaca;
        }

        /* MOBILE CONTROLS */
        .mobile-toggle {
            display: none;
            position: fixed;
            top: 15px;
            left: 15px;
            z-index: 200;
            background: white;
            border: 2px solid var(--border);
            border-radius: 12px;
            padding: 12px;
            box-shadow: var(--shadow-soft);
            cursor: pointer;
            color: var(--primary);
        }

        .sidebar-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(15, 23, 42, 0.8);
            backdrop-filter: blur(2px);
            z-index: 90;
        }

        /* MAIN CONTENT & VIEWS */
        .main-content {
            flex: 1;
            overflow-y: auto;
            padding: 50px 60px;
            position: relative;
            scroll-behavior: smooth;
            max-width: 100vw;
            overflow-x: hidden;
        }

        .section-view {
            display: none;
            animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        }

            .section-view.active {
                display: block;
            }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(15px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 40px;
            flex-wrap: wrap;
            gap: 15px;
        }

        .page-title {
            font-size: 28px;
            font-weight: 800;
            color: var(--primary);
            margin: 0;
            letter-spacing: -0.5px;
        }

        /* MODAL ACESSO NEGADO */
        .modal-denied {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(15, 23, 42, 0.7);
            backdrop-filter: blur(8px);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 10000;
            padding: 20px;
        }

        .denied-box {
            background: white;
            border-radius: 28px;
            padding: 40px;
            max-width: 450px;
            width: 100%;
            text-align: center;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
            animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        @keyframes modalPop {
            from { opacity: 0; transform: scale(0.8); }
            to { opacity: 1; transform: scale(1); }
        }

        .denied-icon {
            width: 80px;
            height: 80px;
            background: #fee2e2;
            color: #ef4444;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 25px;
            font-size: 40px;
        }

        .denied-box h2 {
            margin: 0 0 10px 0;
            color: var(--primary);
            font-size: 24px;
            font-weight: 800;
        }

        .denied-box p {
            color: var(--text-muted);
            line-height: 1.6;
            margin-bottom: 30px;
            font-weight: 500;
        }

        /* TABS */
        .content-tabs {
            display: flex;
            width: 100%;
            background: #e2e8f0;
            padding: 6px;
            border-radius: 14px;
            margin-bottom: 25px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
        }

            .content-tabs::-webkit-scrollbar {
                display: none;
            }

        .content-tab {
            flex: 1;
            text-align: center;
            padding: 12px 10px;
            border-radius: 10px;
            border: none;
            background: transparent;
            color: var(--text-muted);
            font-weight: 700;
            font-size: 14px;
            cursor: pointer;
            transition: 0.3s;
            white-space: nowrap;
        }

            .content-tab:hover {
                color: var(--primary);
            }

            .content-tab.active {
                background: white;
                color: var(--primary);
                box-shadow: 0 2px 6px rgba(0,0,0,0.1);
            }

        .tab-pane {
            display: none;
            animation: fadeIn 0.3s ease;
        }

            .tab-pane.active {
                display: block;
            }

        /* CARDS E GRIDS */
        .card {
            background: white;
            border-radius: var(--radius);
            padding: 30px;
            margin-bottom: 30px;
            box-shadow: var(--shadow-soft);
            border: 1px solid var(--border);
            max-width: 100%;
            box-sizing: border-box;
        }

            .card h3 {
                margin-top: 0;
                font-size: 20px;
                font-weight: 800;
                margin-bottom: 20px;
                color: var(--primary);
            }

        /* METRICAS DASHBOARD */
        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 20px;
            margin-bottom: 40px;
        }

        .metric-card {
            background: white;
            padding: 25px;
            border-radius: var(--radius);
            box-shadow: var(--shadow-soft);
            border: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            transition: all 0.3s ease;
        }

            .metric-card:hover {
                transform: translateY(-5px);
                box-shadow: var(--shadow-hover);
            }

        .metric-val {
            font-size: 32px;
            font-weight: 900;
            color: var(--primary);
            margin: 10px 0;
            letter-spacing: -0.5px;
        }

        .metric-label {
            font-size: 13px;
            font-weight: 800;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .metric-icon {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 15px;
            font-size: 24px;
        }

        /* ACESSO RÁPIDO - HOME DASHBOARD */
        .home-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
            gap: 25px;
            margin-bottom: 40px;
        }

        .home-card {
            background: white;
            padding: 35px 30px;
            border-radius: 20px;
            box-shadow: var(--shadow-soft);
            border: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 20px;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            text-decoration: none;
            color: inherit;
            position: relative;
            overflow: hidden;
        }

            .home-card::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                width: 4px;
                height: 100%;
                background: transparent;
                transition: 0.3s;
            }

            .home-card:hover {
                transform: translateY(-5px);
                box-shadow: var(--shadow-hover);
                border-color: #cbd5e1;
            }

                .home-card:hover::before {
                    background: var(--accent);
                }

        /* COMERCIAL BOARD (ESTILO CRM) */
        .comercial-stats-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .comercial-stat-card {
            background: white;
            padding: 20px;
            border-radius: 20px;
            border: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 15px;
            box-shadow: var(--shadow-soft);
        }

        .comercial-stat-icon {
            width: 48px;
            height: 48px;
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            flex-shrink: 0;
        }

        .comercial-stat-info h4 {
            margin: 0;
            font-size: 12px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .comercial-stat-info .stat-val {
            font-size: 24px;
            font-weight: 900;
            color: var(--primary);
            margin: 2px 0;
        }

        .comercial-stat-info p {
            margin: 0;
            font-size: 11px;
            font-weight: 600;
            color: var(--text-muted);
        }

        .comercial-filter-bar {
            background: white;
            padding: 15px 20px;
            border-radius: 18px;
            border: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 30px;
            box-shadow: var(--shadow-soft);
            flex-wrap: wrap;
        }

        .search-input-wrapper {
            position: relative;
            flex: 1;
            min-width: 250px;
        }

        .search-input-wrapper .material-icons-round {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted);
            font-size: 20px;
        }

        .search-input-wrapper input {
            width: 100%;
            padding: 12px 15px 12px 45px;
            border-radius: 12px;
            border: 1px solid var(--border);
            font-size: 14px;
            font-weight: 600;
            outline: none;
            background: #f8fafc;
            transition: 0.2s;
        }

        .search-input-wrapper input:focus {
            border-color: var(--accent);
            background: white;
            box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
        }

        .filter-select {
            padding: 12px 15px;
            border-radius: 12px;
            border: 1px solid var(--border);
            font-size: 14px;
            font-weight: 700;
            color: var(--primary);
            background: white;
            outline: none;
            cursor: pointer;
        }

        .comercial-board {
            display: flex;
            gap: 25px;
            align-items: flex-start;
            overflow-x: auto;
            padding-bottom: 20px;
            scrollbar-width: none;
        }

        .comercial-board::-webkit-scrollbar {
            display: none;
        }

        .comercial-column {
            flex: 1;
            min-width: 320px;
            background: #f1f5f9;
            border-radius: 24px;
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 15px;
            border: 1px solid var(--border);
        }

        .column-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 5px;
        }

        .column-title {
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 800;
            font-size: 15px;
            color: var(--primary);
        }

        .column-badge {
            background: #e2e8f0;
            color: var(--accent);
            font-size: 12px;
            font-weight: 800;
            padding: 4px 10px;
            border-radius: 20px;
        }

        .lead-card {
            background: white;
            border-radius: 18px;
            padding: 18px;
            border: 1px solid var(--border);
            box-shadow: 0 2px 4px rgba(0,0,0,0.02);
            position: relative;
            transition: 0.2s;
        }

        .lead-card:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow-soft);
            border-color: #cbd5e1;
        }

        .lead-card-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 8px;
        }

        .lead-name {
            font-weight: 800;
            font-size: 15px;
            color: var(--primary);
            margin: 0;
        }

        .lead-time {
            font-size: 11px;
            color: var(--text-muted);
            font-weight: 600;
        }

        .lead-phone {
            font-size: 13px;
            color: var(--text-muted);
            font-weight: 700;
            margin-bottom: 12px;
            display: block;
        }

        .lead-obs {
            font-size: 13px;
            color: #475569;
            line-height: 1.5;
            margin-bottom: 15px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            font-weight: 500;
        }

        .lead-actions {
            display: flex;
            gap: 8px;
            padding-top: 15px;
            border-top: 1px solid #f1f5f9;
        }

        .btn-action-sm {
            flex: 1;
            padding: 10px;
            border-radius: 10px;
            border: 1px solid var(--border);
            background: #f8fafc;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: 0.2s;
        }

        .btn-action-sm:hover {
            background: white;
            transform: translateY(-2px);
        }

        .btn-action-sm.btn-wpp { color: #16a34a; background: #f0fdf4; border-color: #bcf0da; }
        .btn-action-sm.btn-edit { color: #2563eb; background: #eff6ff; border-color: #bfdbfe; }
        .btn-action-sm.btn-del { color: #e11d48; background: #fef2f2; border-color: #fecaca; }

        .history-item {
            background: white;
            padding: 12px;
            border-radius: 14px;
            display: flex;
            align-items: center;
            gap: 12px;
            border: 1px solid var(--border);
        }

        .history-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: #e2e8f0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            font-size: 12px;
            color: var(--text-muted);
            flex-shrink: 0;
        }

        .history-info { flex: 1; min-width: 0; }
        .history-name { font-weight: 700; font-size: 13px; color: var(--primary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .history-meta { font-size: 11px; color: var(--text-muted); font-weight: 500; }
        .history-time { font-size: 10px; color: var(--text-muted); font-weight: 700; white-space: nowrap; }

        .column-footer {
            margin-top: auto;
            text-align: center;
            padding-top: 10px;
        }

        .column-footer a {
            color: var(--accent);
            font-size: 13px;
            font-weight: 800;
            text-decoration: none;
        }

        @media (max-width: 768px) {
            .comercial-board {
                flex-direction: column;
                overflow-x: hidden;
            }
            .comercial-column {
                width: 100%;
                min-width: 100%;
            }
        }

            .home-card.external-card {
                border: 2px dashed var(--border);
                background: #f8fafc;
            }

                .home-card.external-card:hover {
                    border-color: var(--accent);
                    background: white;
                }

                .home-card.external-card::after {
                    content: 'open_in_new';
                    font-family: 'Material Icons Round';
                    position: absolute;
                    top: 20px;
                    right: 20px;
                    color: #cbd5e1;
                    font-size: 24px;
                    transition: 0.3s;
                }

                .home-card.external-card:hover::after {
                    color: var(--accent);
                }

        .home-card-icon {
            width: 64px;
            height: 64px;
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 32px;
            flex-shrink: 0;
        }

        .home-card-content h3 {
            margin: 0 0 6px 0;
            font-size: 20px;
            color: var(--primary);
            font-weight: 800;
            letter-spacing: -0.5px;
        }

        .home-card-content p {
            margin: 0;
            color: var(--text-muted);
            font-size: 14px;
            font-weight: 500;
            line-height: 1.4;
        }

        /* TABELAS GERAIS */
        .table-container {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            width: 100%;
            background: white;
            box-shadow: var(--shadow-soft);
        }

        table {
            width: 100%;
            border-collapse: collapse;
            min-width: 600px;
        }

        th {
            background: #f8fafc;
            color: var(--text-muted);
            font-weight: 700;
            text-transform: uppercase;
            font-size: 12px;
            padding: 18px 20px;
            text-align: left;
            border-bottom: 1px solid var(--border);
            letter-spacing: 0.5px;
        }

        td {
            padding: 18px 20px;
            border-bottom: 1px solid var(--border);
            font-size: 15px;
            vertical-align: middle;
            color: var(--text-main);
        }

        tbody tr:hover {
            background: #f8fafc;
        }

        /* ESTILOS DA TABELA DE PRODUTOS CORRIGIDA */
        .drag-handle {
            cursor: grab;
            color: #cbd5e1;
            padding: 10px;
            transition: 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
        }

            .drag-handle:hover {
                color: var(--primary);
            }

        .sortable-ghost {
            background: #eff6ff;
            opacity: 0.6;
        }

        .sortable-drag {
            background: white;
            box-shadow: var(--shadow-hover);
        }

        .prod-card-flex {
            display: flex;
            gap: 15px;
            align-items: center;
        }

        .prod-img-box {
            width: 60px;
            height: 60px;
            flex-shrink: 0;
            background: white;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid var(--border);
            padding: 4px;
            overflow: hidden;
        }

            .prod-img-box img {
                width: 100%;
                height: 100%;
                object-fit: contain;
                border-radius: 8px;
            }

        .prod-txt-box {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .prod-title {
            font-weight: 800;
            color: var(--primary);
            font-size: 15px;
            display: block;
            line-height: 1.2;
        }

        .prod-badges {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
            margin-top: 6px;
        }

        .vars-container {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            align-items: center;
        }

        .desk-only {
            display: block;
        }

        .prod-td-actions {
            display: flex;
            align-items: center;
            gap: 20px;
            justify-content: space-between;
        }

        .toggles-box {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        /* SWITCH TOGGLE */
        .switch {
            position: relative;
            display: inline-block;
            width: 36px;
            height: 20px;
            flex-shrink: 0;
        }

            .switch input {
                opacity: 0;
                width: 0;
                height: 0;
            }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #e2e8f0;
            transition: .3s;
            border-radius: 34px;
            border: 1px solid #cbd5e1;
        }

            .slider:before {
                position: absolute;
                content: "";
                height: 14px;
                width: 14px;
                left: 2px;
                bottom: 2px;
                background-color: white;
                transition: .3s;
                border-radius: 50%;
                box-shadow: 0 1px 3px rgba(0,0,0,0.2);
            }

        input:checked + .slider {
            background-color: var(--success);
            border-color: var(--success);
        }

            input:checked + .slider:before {
                transform: translateX(16px);
                box-shadow: none;
            }

        .toggle-label {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            font-weight: 800;
            color: var(--text-muted);
            user-select: none;
        }

        /* BOTOES E INPUTS */
        .btn {
            padding: 14px 24px;
            border-radius: 12px;
            border: none;
            cursor: pointer;
            font-weight: 700;
            font-size: 14px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.2s;
            font-family: inherit;
        }

            .btn:hover {
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            }

            .btn:active {
                transform: scale(0.96);
            }

        .btn-add {
            background: var(--accent);
            color: white;
        }

        .btn-save {
            background: var(--primary);
            color: white;
        }

        .btn-cancel {
            background: transparent;
            color: var(--text-muted);
            border: 2px solid var(--border);
        }

        .btn-del {
            background: white;
            border: 2px solid var(--border);
            color: var(--danger);
        }

            .btn-del:hover {
                background: #fef2f2;
                border-color: #fca5a5;
            }

        .btn-edit {
            background: white;
            border: 2px solid var(--border);
            color: var(--primary);
        }

            .btn-edit:hover {
                background: #f8fafc;
                border-color: #cbd5e1;
            }

        .btn-copy {
            background: var(--success);
            color: white;
        }

        .btn-sm {
            padding: 8px 14px;
            font-size: 13px;
        }

        .form-group {
            margin-bottom: 22px;
            width: 100%;
            box-sizing: border-box;
        }

            .form-group label {
                display: block;
                margin-bottom: 8px;
                font-size: 14px;
                font-weight: 700;
                color: var(--text-muted);
            }

            .form-group input, .form-group select, .form-group textarea {
                width: 100%;
                padding: 16px 20px;
                border: 2px solid var(--border);
                border-radius: 12px;
                font-size: 15px;
                font-weight: 600;
                transition: all 0.2s;
                outline: none;
                background: white;
                font-family: inherit;
                color: var(--text-main);
                box-sizing: border-box;
            }

                .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
                    border-color: var(--accent);
                    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
                    background: #f8fafc;
                }

        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 15px;
            user-select: none;
        }

        .vender-grid {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 20px;
        }

        /* MODAIS */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(15, 23, 42, 0.8);
            backdrop-filter: blur(4px);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal-box {
            background: white;
            padding: 40px;
            border-radius: 24px;
            width: 95%;
            max-width: 600px;
            box-shadow: 0 25px 50px -12px rgba(0,0,0,0.3);
            animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            max-height: 90vh;
            overflow-y: auto;
            box-sizing: border-box;
        }

        @keyframes slideUp {
            from {
                transform: translateY(30px);
                opacity: 0;
            }

            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        .modal-buttons {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            margin-top: 35px;
            padding-top: 25px;
            border-top: 1px solid var(--border);
            width: 100%;
        }

            .modal-buttons .btn {
                flex: 1;
            }

        /* TOASTS */
        #toast-container {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .toast {
            background: white;
            padding: 18px 24px;
            border-radius: 14px;
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
            display: flex;
            align-items: center;
            gap: 14px;
            animation: slideIn 0.3s ease;
            border-left: 5px solid var(--primary);
            font-weight: 600;
            font-size: 15px;
            min-width: 300px;
        }

            .toast.error {
                border-left-color: var(--danger);
            }

            .toast.success {
                border-left-color: var(--success);
            }

        @keyframes slideIn {
            from {
                transform: translateX(100%);
                opacity: 0;
            }

            to {
                transform: translateX(0);
            }
        }

        /* EXTRAS */
        .thumb-img {
            width: 60px;
            height: 40px;
            object-fit: cover;
            border-radius: 8px;
            border: 1px solid var(--border);
        }

        .badge {
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 11px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .badge-novo {
            background: #eff6ff;
            color: #2563eb;
        }

        .badge-seminovo {
            background: #f1f5f9;
            color: #475569;
        }

        .badge-apple {
            background: #1e293b;
            color: white;
        }

        .badge-android {
            background: #dcfce7;
            color: #166534;
        }

        .badge-outros {
            background: #f1f5f9;
            color: #64748b;
        }

        .link-generator-box {
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            border: 1px solid var(--border);
        }

        /* Empty States */
        .card-pendentes {
            border: 2px solid #bae6fd;
        }

            .card-pendentes.is-empty {
                border: 1px dashed var(--border) !important;
                background: transparent !important;
            }

        .empty-row td {
            text-align: center !important;
            padding: 40px 20px !important;
            color: var(--text-muted) !important;
            border-bottom: none !important;
            font-size: 15px;
            font-weight: 600;
        }

            .empty-row td::before {
                display: none !important;
            }

        /* NOVO DESIGN DO CARD LEAD - DESKTOP/MOBILE */
        .lead-info-box {
            display: flex;
            flex-direction: column;
            gap: 6px;
            width: 100%;
        }

        .lead-obs-box {
            background: #f8fafc;
            border: 1px dashed var(--border);
            padding: 12px;
            border-radius: 8px;
            font-size: 13px;
            color: var(--text-muted);
            text-align: left;
            width: 100%;
            white-space: pre-wrap;
            margin-top: 4px;
            line-height: 1.4;
        }

        /* Desktop Estilização de Botões e Separação de Cards */
        @media (min-width: 769px) {
            .btn-adaptive {
                display: inline-flex !important;
                align-items: center;
                gap: 6px;
                padding: 10px 16px !important;
                width: auto !important;
                height: auto !important;
                border-radius: 12px !important;
            }

            td[data-label="Ações"] {
                display: flex;
                gap: 8px;
                flex-wrap: wrap;
                align-items: center;
            }

            /* Separação dos cards na versão desktop */
            #tab-vitrine > .card {
                background: transparent !important;
                border: none !important;
                box-shadow: none !important;
                padding: 0 !important;
            }

            #tab-vitrine .table-container {
                background: transparent !important;
                border: none !important;
                box-shadow: none !important;
            }

            #tabela-corpo-wrapper {
                border-collapse: separate !important;
                border-spacing: 0 15px !important;
            }

            #tabela-corpo tr {
                background: white;
                box-shadow: var(--shadow-soft);
                transition: transform 0.2s;
            }

                #tabela-corpo tr:hover {
                    transform: translateY(-2px);
                    box-shadow: var(--shadow-hover);
                }

            #tabela-corpo td {
                border: none;
                background: white;
            }

                #tabela-corpo td:first-child {
                    border-top-left-radius: 16px;
                    border-bottom-left-radius: 16px;
                }

                #tabela-corpo td:last-child {
                    border-top-right-radius: 16px;
                    border-bottom-right-radius: 16px;
                }

                /* Remover bordas das miniaturas e ícones de arraste no desktop */
                .prod-img-box, .drag-handle {
                    border: none !important;
                    box-shadow: none !important;
                }
            }

        /* -------------------------------------------
           MOBILE RESPONSIVO OTIMIZADO SUPER UPDATE
        ---------------------------------------------- */
        @media(max-width:768px) {
            .sidebar {
                position: fixed;
                left: -100%;
                height: 100%;
                width: 280px;
                box-shadow: 4px 0 25px rgba(0,0,0,0.1);
            }

                .sidebar.active {
                    left: 0;
                }

            .sidebar-overlay.active {
                display: block;
            }

            .mobile-toggle {
                display: flex;
            }

            .main-content {
                padding: 80px 15px 100px 15px;
            }

            .page-title {
                font-size: 26px;
            }

            .home-grid {
                grid-template-columns: 1fr;
                gap: 15px;
            }

            .home-card {
                padding: 30px 20px;
                flex-direction: column;
                text-align: center;
                justify-content: center;
            }

            .home-card-content h3 {
                font-size: 22px;
            }

            .vender-grid {
                grid-template-columns: 1fr !important;
                gap: 0;
            }

            /* TABS */
            .content-tabs {
                flex-wrap: nowrap;
                padding: 6px;
                gap: 8px;
                display: flex;
                width: 100%;
            }

            .content-tab {
                flex: 1;
                padding: 12px 5px;
                text-align: center;
                white-space: normal;
            }

            .page-header div[style*="display:flex"] {
                flex-direction: column;
                width: 100%;
            }

                .page-header div[style*="display:flex"] .btn {
                    width: 100%;
                }

            .table-container {
                border: none !important;
                background: transparent !important;
                padding: 0 !important;
                overflow: hidden !important;
                box-shadow: none !important;
            }

            /* Remove a borda azul externa do card de pendentes no mobile */
            .card-pendentes {
                border: none !important;
            }

            table.mobile-cards, table {
                min-width: 100% !important;
                display: block;
                border-collapse: separate !important; /* Impede que a tabela anule espaçamentos */
            }

                table.mobile-cards thead, table thead {
                    display: none !important;
                }

                /* Usamos flexbox no tbody para garantir o espaçamento (gap) perfeito e inquebrável entre os cards */
                table.mobile-cards tbody, table tbody {
                    display: flex !important;
                    flex-direction: column !important;
                    gap: 16px !important; /* Espaçamento exato entre um card de cliente e outro */
                    width: 100%;
                }

                table.mobile-cards tr, table tr {
                    display: block;
                    background: white;
                    border-radius: 16px;
                    border: 1px solid var(--border);
                    margin-bottom: 0 !important; /* Como usamos o gap acima, zeramos a margem aqui */
                    box-shadow: var(--shadow-soft);
                    padding: 0;
                    width: 100%;
                    box-sizing: border-box;
                    overflow: hidden;
                }

                table.mobile-cards td, table td {
                    display: block;
                    width: 100%;
                    box-sizing: border-box;
                    text-align: right !important;
                    padding: 16px 20px !important;
                    border-bottom: 1px dashed var(--border) !important;
                    position: relative;
                }

                    /* Correção para alinhamento top no mobile (Ideal para multilinhas e observações) */
                    table.mobile-cards td::before {
                        content: attr(data-label);
                        position: absolute;
                        left: 20px;
                        top: 16px; /* Ajuste crítico: Topo ao invés do centro */
                        font-size: 11px;
                        font-weight: 800;
                        color: var(--text-muted);
                        text-transform: uppercase;
                        text-align: left;
                        width: 40%;
                        display: block;
                    }

                    /* Reset para a célula da Observação do Lead fluir bem */
                    table.mobile-cards td.lead-full-mobile {
                        display: flex !important;
                        flex-direction: column !important;
                        align-items: flex-start !important; /* Alinha o conteúdo à esquerda */
                        text-align: left !important;
                    }

                        table.mobile-cards td.lead-full-mobile::before {
                            position: relative !important; /* Remove a sobreposição */
                            left: 0 !important;
                            top: 0 !important;
                            transform: none !important;
                            width: 100% !important;
                            margin-bottom: 10px !important; /* Dá um espaço antes do nome */
                            display: block !important;
                        }

                    table td:last-child, table.mobile-cards td:last-child {
                        border-bottom: none !important;
                    }

                    table.mobile-cards td[data-label="Ações"] {
                        display: flex !important;
                        flex-direction: row;
                        gap: 10px;
                        padding: 16px 20px !important;
                        justify-content: space-between;
                    }

                        table.mobile-cards td[data-label="Ações"]::before {
                            display: none !important;
                        }

            /* Ocultar textos no mobile Leads */
            .btn-adaptive .desk-text {
                display: none;
            }

            .btn-adaptive {
                padding: 12px !important;
                width: 44px !important;
                height: 44px !important;
                justify-content: center !important;
            }

            td[data-label="Ações"] .btn:not(.btn-adaptive) {
                flex: 1;
                margin: 0 !important;
            }

            /* TELA PRODUTOS SUPER REDUZIDA E LIMPA NO MOBILE */
            .desk-only {
                display: none !important;
                border: none !important;
                margin: 0 !important;
                padding: 0 !important;
            }

            #tab-vitrine > .card, #tab-pronta > .card {
                background: transparent !important;
                border: none !important;
                box-shadow: none !important;
                padding: 0 !important;
            }

            table#tabela-corpo tr {
                display: flex;
                flex-direction: column;
                padding: 16px !important;
                gap: 16px;
                background: white !important;
                border: 1px solid var(--border) !important;
                border-radius: 16px !important;
                margin-bottom: 16px !important;
                position: relative;
                box-shadow: var(--shadow-soft) !important;
            }

            table#tabela-corpo td {
                display: block;
                padding: 0 !important;
                text-align: left !important;
                border: none !important;
                width: 100%;
            }

                table#tabela-corpo td::before {
                    display: none !important;
                    content: none !important;
                }

            .prod-td-ordem {
                display: none !important;
            }

            .prod-card-flex {
                align-items: center;
                padding-right: 0 !important;
            }

            .prod-title {
                font-size: 16px;
                line-height: 1.2;
            }

            .prod-td-actions {
                display: flex;
                flex-direction: row !important;
                align-items: center;
                justify-content: space-between !important;
                gap: 10px;
                border-top: 1px solid var(--border) !important;
                padding-top: 16px !important;
                margin-top: 0 !important;
            }

            .toggles-box {
                display: flex;
                flex-direction: row !important;
                gap: 15px !important;
            }

            .prod-td-actions .btn {
                flex: 0 0 auto;
                width: auto;
                margin: 0 !important;
                padding: 10px 16px !important;
            }

            /* TELA AJUSTES TRAVADA NO MOBILE */
            #view-config .config-content {
                display: none !important;
            }

            #view-config .mobile-lock-msg {
                display: block !important;
            }

            .modal-box {
                padding: 24px 20px;
                border-bottom-left-radius: 0;
                border-bottom-right-radius: 0;
                position: absolute;
                bottom: 0;
                width: 100%;
                box-sizing: border-box;
                padding-bottom: max(24px, env(safe-area-inset-bottom));
                animation: slideUpMobile 0.3s ease-out;
            }

            @keyframes slideUpMobile {
                from {
                    transform: translateY(100%);
                }

                to {
                    transform: translateY(0);
                }
            }
        }

        /* AJUSTE FERRAMENTAS DESKTOP */
        @media (max-width: 1100px) {
            .ferramentas-grid-layout {
                grid-template-columns: 1fr !important;
            }
        }